I'm having my first contact with Vertx's EventBus and I realized there are two ways to submit a message. Used the send or publish method. I ask: What is the practical difference between using these two methods and in what scenario do they use each one?
Both send
and publish
are used to send a message to an event bus address. However there are some differences between the two.
By using publish
:
By using send
:
In practical usage, publish
is quite useful to inform that an event has occured, whereas send
is quite handy for asking a treatment where the response matters.
Conceptually, publish
uses the publish/subscribe pattern whereas send
uses the request/response pattern.