A distributed lightweight event bus which can encompass multiple vert.x instances. The event bus implements publish / subscribe, point to point messaging and request-response messaging.
Messages sent over the event bus are represented by instances of the
For publish / subscribe, messages can be published to an address using one of the
publish methods. An
address is a simple
Handlers are registered against an address. There can be multiple handlers registered against each address, and a particular handler can be registered against multiple addresses. The event bus will route a sent message to all handlers which are registered against that address.
For point to point messaging, messages can be sent to an address using one of the
The messages will be delivered to a single handler, if one is registered on that address. If more than one
handler is registered on the same address, Vert.x will choose one and deliver the message to that. Vert.x will
aim to fairly distribute messages in a round-robin way, but does not guarantee strict round-robin under all
All messages sent over the bus are transient. On event of failure of all or part of the event bus messages may be lost. Applications should be coded to cope with lost messages, e.g. by resending them, and making application services idempotent.
The order of messages received by any specific handler from a specific sender should match the order of messages sent from that sender.
When sending a message, a reply handler can be provided. If so, it will be called when the reply from the receiver has been received. Reply messages can also be replied to, etc, ad infinitum
Different event bus instances can be clustered together over a network, to give a single logical event bus.
Instances of EventBus are thread-safe.
If handlers are registered from an event loop, they will be executed using that same event loop. If they are registered from outside an event loop (i.e. when using Vert.x embedded) then Vert.x will assign an event loop to the handler and use it to deliver messages to that handler.
no subtypes hierarchy
|Attributes inherited from: |
Publish a message
Registers a handler against the specified address. The method returns a registration whose:
Send a message via the event bus. The returned promise allows to receive any reply message from the recipient.
|Methods inherited from: |