Interaction of standard verticle with worker verticles in the same vertx instance vs executeBlocking

72 views
Skip to first unread message

Konstantinos Liakos

unread,
Oct 19, 2016, 10:55:10 AM10/19/16
to vert.x
From what I have read, a standard verticle can interact with worker verticles in the same instance only by using the event bus (exchange messages).

However since vertx 3 has introduced the executeBlocking method, I can't see an actual use case where someone would prefer to deploy worker verticles, instread of using the executeBlocking method for blocking operations. I would even say that the worker verticle solution has the overhead of serializing/deserializing the messages if you are working with POJOs.

So is there any other additional interaction between the standard and worker verticles in the same instance that makes it worth to use this model structure instead of the executeBlocking?

Alexander Lehmann

unread,
Oct 19, 2016, 4:57:57 PM10/19/16
to vert.x
You may need to keep some kind of state in the worker verticle (e.g. persistent connections) in the worker verticle, which might work better with a worker verticle.

Julien Viet

unread,
Oct 20, 2016, 5:52:01 PM10/20/16
to ve...@googlegroups.com
2 reasons

1/ encapsulate your logic in a worker verticle - that gives the ability to test it in isolation - or swap the implementation
2/ you can distribute it and scale it

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/b1ec5d08-54dc-4fc4-bbe4-2ae7945d51d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ad...@cs.miami.edu

unread,
Oct 23, 2016, 10:52:31 PM10/23/16
to vert.x
Hi group,

To reinforce some ideas.  ExecuteBlocking is great for "inlined" operations, or operations that make sense in that particular situation.  But, worker verticles allow better encapsulation (as has been said).  Also, if you put your operations in a worker verticle, you can then easily (as in no code change) put the worker on another server and it will work out of the box along the eventbus.

However, you are correct that the serialization in and out of the Worker can be a bit cumbersome compared with POJOs.  I like how vertx gives the programmer the flexibilty of using both Workers and ExecuteBlocking.

-Adam
Reply all
Reply to author
Forward
0 new messages