Reputation: 57
I am confused about standard verticle and worker verticle in Vertx. And What are the use cases of them?
Upvotes: 0
Views: 3211
Reputation: 26743
Vert.x is an event-driven and non-blocking toolkit. When a “standard” verticle gets executed, its logic runs on an event loop thread. Whilst this thread runs the logic of that verticle, it cannot serve any other request, so this thread should not execute any blocking code.
But, sometimes, you do need to execute blocking code — doing a long computation, calling an external service synchronously, etc. — in which case, you need to make sure this doesn't happen on an event loop thread.
You have two ways to execute blocking code:
executeBlocking
block, which executes in a separate thread.Upvotes: 6