Should I to keep a global reference to vertx objec...
# vertx
f
Should I to keep a global reference to vertx object or use Vertx.vertx() every where?
After some search, it seems that the good solution is to keep a vertx reference
n
Will depend on your situation however it is a bad idea to have a global ref to Vertx. Have a look at this example (https://github.com/napperley/vertx-kotlintest/blob/master/src/test/kotlin/org/digieng/vertx/kotlintest/HttpClientExtensionsTest.kt) for a situation where Vert.x code is being tested.
👍 1
f
mmm in this example, it use the Abstract Verticle for provide vertx. So have a new Vertx inside each Verticle is great