0
votes

I have a Vert.x application with several verticls to interact with different buses and dbs (mongo, redis, rabbit, kafka and such)

among those there is a verticle dedicated for communication with external api (very old) which allow for one persistent connection and from a single (pre defined) source

I'm deploying mutli instances of vertx with the same code (auto-scale) and make them act as a cluster, using hazelcast as a cluster manager

what is the best practice for limiting the creation of the external-api verticle to only single instance, I looked at:

  • SharedData.Lock() - but I'll need to wrap it with an async spinning lock logic
  • High Availability - great for termination and auto-scaling but doesn't force activity of a single verticle
  • worker verticle - to create 1 worker verticle in each instance

I could use a mix of all the above and create the desired functionality, but I seems some what complex...

should I separate my verticle to a different server or there is some simpler solution I haven't thought of yet?

1
SharedData.Lock() would let you create a dedicated connection to your legacy api, but of course it won't forbid create multiple instances of the same verticle. - injecteer
I would recommend running this on a separate server/pod, as having "exactly one" is not something Vert.x attempts to solve. - Alexey Soshin

1 Answers

0
votes

You don't need single verticle , leave that verticle to be just stateless and apply your connections in Proxy service - after you can register that service as HttpEndpoint , Evenbus , Message or JDBC service types and you will have single point of comminication with db or external http source.