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 completionHandlerfunction may be null- Source:
-
consumer(address, handler) → {MessageConsumer}
-
Create a consumer and register it against the specified address.
Parameters:
Name Type Description addressstring the address that will register it at handlerfunction 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 addressstring the address that will register it at handlerfunction 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
optionsthat can be used to configure the delivery.Parameters:
Name Type Description addressstring the address to publish it to messageObject the message, may be nulloptionsObject 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 addressstring the address to publish it to optionsObject the delivery options - Source:
Returns:
The publisher- Type
- MessageProducer
-
send(address, message, options, replyHandler) → {EventBus}
-
Like EventBus#send but specifying a
replyHandlerthat will be called if the recipient subsequently replies to the message.Parameters:
Name Type Description addressstring the address to send it to messageObject the message, may be nulloptionsObject delivery options replyHandlerfunction reply handler will be called when any reply from the recipient is received, may be 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 addressstring the address to send it to optionsObject the delivery options - Source:
Returns:
The sender- Type
- MessageProducer