public class EventBus extends Object implements Measured
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.
NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<EventBus> |
__TYPE_ARG |
Constructor and Description |
---|
EventBus(EventBus delegate) |
EventBus(Object delegate) |
Modifier and Type | Method and Description |
---|---|
<T> EventBus |
addInboundInterceptor(Handler<DeliveryContext<T>> interceptor)
Add an interceptor that will be called whenever a message is received by Vert.x
|
<T> EventBus |
addOutboundInterceptor(Handler<DeliveryContext<T>> interceptor)
Add an interceptor that will be called whenever a message is sent from Vert.x
|
<T> MessageConsumer<T> |
consumer(String address)
Create a message consumer against the specified address.
|
<T> MessageConsumer<T> |
consumer(String address,
Handler<Message<T>> handler)
Create a consumer and register it against the specified address.
|
boolean |
equals(Object o) |
EventBus |
getDelegate() |
int |
hashCode() |
boolean |
isMetricsEnabled()
Whether the metrics are enabled for this measured object
|
<T> MessageConsumer<T> |
localConsumer(String address)
Like
consumer(java.lang.String) but the address won't be propagated across the cluster. |
<T> MessageConsumer<T> |
localConsumer(String address,
Handler<Message<T>> handler)
Like
consumer(java.lang.String) but the address won't be propagated across the cluster. |
static EventBus |
newInstance(EventBus arg) |
EventBus |
publish(String address,
Object message)
Publish a message.
|
EventBus |
publish(String address,
Object message,
DeliveryOptions options)
Like but specifying
options that can be used to configure the delivery. |
<T> MessageProducer<T> |
publisher(String address)
Create a message publisher against the specified address.
|
<T> MessageProducer<T> |
publisher(String address,
DeliveryOptions options)
Like
publisher(java.lang.String) but specifying delivery options that will be used for configuring the delivery of
the message. |
EventBus |
registerCodec(MessageCodec codec)
Register a message codec.
|
<T> EventBus |
removeInboundInterceptor(Handler<DeliveryContext<T>> interceptor)
Remove an interceptor that was added by
addInboundInterceptor(io.vertx.core.Handler<io.vertx.rxjava.core.eventbus.DeliveryContext<T>>) |
<T> EventBus |
removeOutboundInterceptor(Handler<DeliveryContext<T>> interceptor)
Remove an interceptor that was added by
addOutboundInterceptor(io.vertx.core.Handler<io.vertx.rxjava.core.eventbus.DeliveryContext<T>>) |
<T> EventBus |
request(String address,
Object message)
Sends a message and specify a
replyHandler that will be called if the recipient
subsequently replies to the message. |
<T> EventBus |
request(String address,
Object message,
DeliveryOptions options)
Like but specifying
options that can be used to configure the delivery. |
<T> EventBus |
request(String address,
Object message,
DeliveryOptions options,
Handler<AsyncResult<Message<T>>> replyHandler)
Like but specifying
options that can be used to configure the delivery. |
<T> EventBus |
request(String address,
Object message,
Handler<AsyncResult<Message<T>>> replyHandler)
Sends a message and specify a
replyHandler that will be called if the recipient
subsequently replies to the message. |
<T> Single<Message<T>> |
rxRequest(String address,
Object message)
Sends a message and specify a
replyHandler that will be called if the recipient
subsequently replies to the message. |
<T> Single<Message<T>> |
rxRequest(String address,
Object message,
DeliveryOptions options)
Like but specifying
options that can be used to configure the delivery. |
EventBus |
send(String address,
Object message)
Sends a message.
|
EventBus |
send(String address,
Object message,
DeliveryOptions options)
Like but specifying
options that can be used to configure the delivery. |
<T> MessageProducer<T> |
sender(String address)
Create a message sender against the specified address.
|
<T> MessageProducer<T> |
sender(String address,
DeliveryOptions options)
Like
sender(java.lang.String) but specifying delivery options that will be used for configuring the delivery of
the message. |
String |
toString() |
EventBus |
unregisterCodec(String name)
Unregister a message codec.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
newInstance
public static final io.vertx.lang.rx.TypeArg<EventBus> __TYPE_ARG
public EventBus(EventBus delegate)
public EventBus(Object delegate)
public EventBus getDelegate()
getDelegate
in interface Measured
public boolean isMetricsEnabled()
isMetricsEnabled
in interface Measured
true
if metrics are enabledpublic EventBus send(String address, Object message)
The message will be delivered to at most one of the handlers registered to the address.
address
- the address to send it tomessage
- the message, may be null
public EventBus send(String address, Object message, DeliveryOptions options)
options
that can be used to configure the delivery.address
- the address to send it tomessage
- the message, may be null
options
- delivery optionspublic <T> EventBus request(String address, Object message, Handler<AsyncResult<Message<T>>> replyHandler)
replyHandler
that will be called if the recipient
subsequently replies to the message.
The message will be delivered to at most one of the handlers registered to the address.
address
- the address to send it tomessage
- the message body, may be null
replyHandler
- reply handler will be called when any reply from the recipient is receivedpublic <T> EventBus request(String address, Object message)
replyHandler
that will be called if the recipient
subsequently replies to the message.
The message will be delivered to at most one of the handlers registered to the address.
address
- the address to send it tomessage
- the message body, may be null
public <T> Single<Message<T>> rxRequest(String address, Object message)
replyHandler
that will be called if the recipient
subsequently replies to the message.
The message will be delivered to at most one of the handlers registered to the address.
address
- the address to send it tomessage
- the message body, may be null
public <T> EventBus request(String address, Object message, DeliveryOptions options, Handler<AsyncResult<Message<T>>> replyHandler)
options
that can be used to configure the delivery.address
- the address to send it tomessage
- the message body, may be null
options
- delivery optionsreplyHandler
- reply handler will be called when any reply from the recipient is receivedpublic <T> EventBus request(String address, Object message, DeliveryOptions options)
options
that can be used to configure the delivery.address
- the address to send it tomessage
- the message body, may be null
options
- delivery optionspublic <T> Single<Message<T>> rxRequest(String address, Object message, DeliveryOptions options)
options
that can be used to configure the delivery.address
- the address to send it tomessage
- the message body, may be null
options
- delivery optionspublic EventBus publish(String address, Object message)
The message will be delivered to all handlers registered to the address.
address
- the address to publish it tomessage
- the message, may be null
public EventBus publish(String address, Object message, DeliveryOptions options)
options
that can be used to configure the delivery.address
- the address to publish it tomessage
- the message, may be null
options
- the delivery optionspublic <T> MessageConsumer<T> consumer(String address)
The returned consumer is not yet registered
at the address, registration will be effective when MessageConsumer.handler(io.vertx.core.Handler<io.vertx.rxjava.core.eventbus.Message<T>>)
is called.
address
- the address that it will register it atpublic <T> MessageConsumer<T> consumer(String address, Handler<Message<T>> handler)
address
- the address that will register it athandler
- the handler that will process the received messagespublic <T> MessageConsumer<T> localConsumer(String address)
consumer(java.lang.String)
but the address won't be propagated across the cluster.address
- the address to register it atpublic <T> MessageConsumer<T> localConsumer(String address, Handler<Message<T>> handler)
consumer(java.lang.String)
but the address won't be propagated across the cluster.address
- the address that will register it athandler
- the handler that will process the received messagespublic <T> MessageProducer<T> sender(String address)
The returned sender will invoke the
method when the stream WriteStream.write(T, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
method is called with the sender
address and the provided data.
address
- the address to send it topublic <T> MessageProducer<T> sender(String address, DeliveryOptions options)
sender(java.lang.String)
but specifying delivery options that will be used for configuring the delivery of
the message.address
- the address to send it tooptions
- the delivery optionspublic <T> MessageProducer<T> publisher(String address)
The returned publisher will invoke the
method when the stream WriteStream.write(T, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
method is called with the publisher
address and the provided data.
address
- The address to publish it topublic <T> MessageProducer<T> publisher(String address, DeliveryOptions options)
publisher(java.lang.String)
but specifying delivery options that will be used for configuring the delivery of
the message.address
- the address to publish it tooptions
- the delivery optionspublic <T> EventBus addOutboundInterceptor(Handler<DeliveryContext<T>> interceptor)
interceptor
- the interceptorpublic <T> EventBus removeOutboundInterceptor(Handler<DeliveryContext<T>> interceptor)
addOutboundInterceptor(io.vertx.core.Handler<io.vertx.rxjava.core.eventbus.DeliveryContext<T>>)
interceptor
- the interceptorpublic <T> EventBus addInboundInterceptor(Handler<DeliveryContext<T>> interceptor)
interceptor
- the interceptorpublic <T> EventBus removeInboundInterceptor(Handler<DeliveryContext<T>> interceptor)
addInboundInterceptor(io.vertx.core.Handler<io.vertx.rxjava.core.eventbus.DeliveryContext<T>>)
interceptor
- the interceptorpublic EventBus registerCodec(MessageCodec codec)
You can register a message codec if you want to send any non standard message across the event bus. E.g. you might want to send POJOs directly across the event bus.
To use a message codec for a send, you should specify it in the delivery options.
codec
- the message codec to registerpublic EventBus unregisterCodec(String name)
name
- the name of the codecCopyright © 2022 Eclipse. All rights reserved.