new EventBus()
A Vert.x event-bus is a light-weight distributed messaging system which allows different parts of your application,
or different applications and services to communicate with each in a loosely coupled way.
An event-bus supports publish-subscribe messaging, point-to-point messaging and request-response messaging.
Message delivery is best-effort and messages can be lost if failure of all or part of the event bus occurs.
Please refer to the documentation for more information on the event bus.
- Source:
Methods
-
close(completionHandler)
-
Close the event bus and release any resources held
Parameters:
Name Type Description completionHandler
function may be {@code null} - Source:
-
consumer(address, handler) → {MessageConsumer}
-
Create a consumer and register it against the specified address.
Parameters:
Name Type Description address
string the address that will register it at handler
function the handler that will process the received messages - Source:
Returns:
the event bus message consumer- Type
- MessageConsumer
-
isMetricsEnabled() → {boolean}
-
Whether the metrics are enabled for this measured object
- Source:
Returns:
true if the metrics are enabled- Type
- boolean
-
localConsumer(address, handler) → {MessageConsumer}
-
Like EventBus#consumer but the address won't be propagated across the cluster.
Parameters:
Name Type Description address
string the address that will register it at handler
function the handler that will process the received messages - Source:
Returns:
the event bus message consumer- Type
- MessageConsumer
-
publish(address, message, options) → {EventBus}
-
Like EventBus#publish but specifying
options
that can be used to configure the delivery.Parameters:
Name Type Description address
string the address to publish it to message
Object the message, may be {@code null} options
Object the delivery options - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- EventBus
-
publisher(address, options) → {MessageProducer}
-
Like EventBus#publisher but specifying delivery options that will be used for configuring the delivery of the message.
Parameters:
Name Type Description address
string the address to publish it to options
Object the delivery options - Source:
Returns:
The publisher- Type
- MessageProducer
-
send(address, message, options, replyHandler) → {EventBus}
-
Like EventBus#send but specifying a
replyHandler
that will be called if the recipient subsequently replies to the message.Parameters:
Name Type Description address
string the address to send it to message
Object the message, may be {@code null} options
Object delivery options replyHandler
function reply handler will be called when any reply from the recipient is received, may be {@code null} - Source:
Returns:
a reference to this, so the API can be used fluently- Type
- EventBus
-
sender(address, options) → {MessageProducer}
-
Like EventBus#sender but specifying delivery options that will be used for configuring the delivery of the message.
Parameters:
Name Type Description address
string the address to send it to options
Object the delivery options - Source:
Returns:
The sender- Type
- MessageProducer