Close the EventBus and release all resources.
Close the EventBus and release all resources.
handler to notify when close is completed
Return the value for default send timeout.
Publish a message.
Publish a message.
The address to publish it to
The message
Registers a handler against the specified address.
Registers a handler against the specified address. To unregister this handler, use the resulting RegisteredHandler object.
The address to register it at.
The handler.
Optional completion handler. If specified, when the register has been propagated to all nodes of the event bus, the handler will be called.
Registers a handler against the specified address.
Registers a handler against the specified address. To unregister this handler, use the resulting RegisteredHandler object.
The address to register it at.
The handler.
Registers a local handler against the specified address.
Registers a local handler against the specified address. The handler info won't be propagated across the cluster. To unregister this handler, use the resulting RegisteredHandler object.
The address to register it at.
The handler to register.
Send a message.
Send a message.
The address to send it to
The message
Reply handler will be called when any reply from the recipient is received
Send a message.
Send a message.
The address to send it to
The message
Send a character as a message
Send a character as a message
The address to send it to
The message
- Timeout in ms. If no reply received within the timeout then the reply handler will be unregistered
Reply handler will be called when any reply from the recipient is received
Sets a default timeout, in ms, for replies.
Sets a default timeout, in ms, for replies. If a messages is sent specify a reply handler but without specifying a timeout, then the reply handler is timed out, i.e. it is automatically unregistered if a message hasn't been received before timeout. The default value for default send timeout is -1, which means "never timeout".
timeout in milliseconds
Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types
Helper method wrapping invocations and returning the Scala type, once again to help provide fluent return types
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 org.vertx.scala.core.eventbus.Message class.
For publish / subscribe, messages can be published to an address using one of the
publish
methods. An address is a simple java.lang.String instance.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
send
methods. 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 circumstances.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.