Reputation: 11
In java vertx application, I have a standard verticle and in it there are multiple consumers and their handlers. Now, let's say verticle is deployed using one of the eventloop threads eventloop-5, now as per my understanding all the handlers will be executed by that thread only (eventloop-5). Is it possible that the consumer handler can be executed by some other eventloop threads based on load balancing or due to some other reason??
Upvotes: 0
Views: 48
Reputation: 1393
The handlers of your Verticle are bound to one thread. That is by design, so you do not need to care about multi threading.
You can, however, deploy that Verticle multiple times. That way, the handlers can be executed by other threads.
To be more clear, if your handler is dealing with incoming HTTP requests, Vert.x supports round robin load balancing over the CPU cores, if the Verticle is deployed several times, see here.
Same applies, if your handler deals with messages from the EventBus, see here.
Upvotes: 0