public class EventBusImpl extends Object implements EventBus, MetricsProvider
| Modifier and Type | Class and Description |
|---|---|
static class |
EventBusImpl.EventBusNetServer |
class |
EventBusImpl.HandlerRegistration<T> |
| Constructor and Description |
|---|
EventBusImpl(VertxInternal vertx) |
EventBusImpl(VertxInternal vertx,
long pingInterval,
long pingReplyInterval,
ClusterManager clusterManager,
HAManager haManager,
AsyncMultiMap<String,ServerID> subs,
ServerID serverID,
EventBusImpl.EventBusNetServer server) |
| Modifier and Type | Method and Description |
|---|---|
void |
close(Handler<AsyncResult<Void>> completionHandler)
Close the event bus and release any resources held
|
<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.
|
protected void |
finalize() |
EventBusMetrics<?> |
getMetrics()
Returns the metrics implementation.
|
boolean |
isMetricsEnabled()
Whether the metrics are enabled for this measured object
|
<T> MessageConsumer<T> |
localConsumer(String address)
Like
EventBus.consumer(String) but the address won't be propagated across the cluster. |
<T> MessageConsumer<T> |
localConsumer(String address,
Handler<Message<T>> handler)
Like
EventBus.consumer(String, Handler) but the address won't be propagated across the cluster. |
EventBus |
publish(String address,
Object message)
Publish a message.
|
EventBus |
publish(String address,
Object message,
DeliveryOptions options)
Like
EventBus.publish(String, Object) 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
EventBus.publisher(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 |
registerDefaultCodec(Class<T> clazz,
MessageCodec<T,?> codec)
Register a default message codec.
|
EventBus |
send(String address,
Object message)
Sends a message.
|
<T> EventBus |
send(String address,
Object message,
DeliveryOptions options)
Like
EventBus.send(String, Object) but specifying options that can be used to configure the delivery. |
<T> EventBus |
send(String address,
Object message,
DeliveryOptions options,
Handler<AsyncResult<Message<T>>> replyHandler)
Like
EventBus.send(String, Object, DeliveryOptions) but specifying a replyHandler that will be called if the recipient
subsequently replies to the message. |
<T> EventBus |
send(String address,
Object message,
Handler<AsyncResult<Message<T>>> replyHandler)
Like
EventBus.send(String, Object) but specifying a replyHandler that will be called if the recipient
subsequently replies to the message. |
<T> MessageProducer<T> |
sender(String address)
Create a message sender against the specified address.
|
<T> MessageProducer<T> |
sender(String address,
DeliveryOptions options)
Like
EventBus.sender(String) but specifying delivery options that will be used for configuring the delivery of
the message. |
EventBus |
unregisterCodec(String name)
Unregister a message codec.
|
EventBus |
unregisterDefaultCodec(Class clazz)
Unregister a default message codec.
|
public EventBusImpl(VertxInternal vertx)
public EventBusImpl(VertxInternal vertx, long pingInterval, long pingReplyInterval, ClusterManager clusterManager, HAManager haManager, AsyncMultiMap<String,ServerID> subs, ServerID serverID, EventBusImpl.EventBusNetServer server)
public EventBus send(String address, Object message)
EventBusThe message will be delivered to at most one of the handlers registered to the address.
public <T> EventBus send(String address, Object message, Handler<AsyncResult<Message<T>>> replyHandler)
EventBusEventBus.send(String, Object) but specifying a replyHandler that will be called if the recipient
subsequently replies to the message.public <T> EventBus send(String address, Object message, DeliveryOptions options)
EventBusEventBus.send(String, Object) but specifying options that can be used to configure the delivery.public <T> EventBus send(String address, Object message, DeliveryOptions options, Handler<AsyncResult<Message<T>>> replyHandler)
EventBusEventBus.send(String, Object, DeliveryOptions) but specifying a replyHandler that will be called if the recipient
subsequently replies to the message.send in interface EventBusaddress - the address to send it tomessage - the message, may be nulloptions - delivery optionsreplyHandler - reply handler will be called when any reply from the recipient is received, may be nullpublic <T> MessageProducer<T> sender(String address)
EventBus
The returned sender will invoke the EventBus.send(String, Object)
method when the stream WriteStream.write(Object) method is called with the sender
address and the provided data.
public <T> MessageProducer<T> sender(String address, DeliveryOptions options)
EventBusEventBus.sender(String) but specifying delivery options that will be used for configuring the delivery of
the message.public <T> MessageProducer<T> publisher(String address)
EventBus
The returned publisher will invoke the EventBus.publish(String, Object)
method when the stream WriteStream.write(Object) method is called with the publisher
address and the provided data.
public <T> MessageProducer<T> publisher(String address, DeliveryOptions options)
EventBusEventBus.publisher(String) but specifying delivery options that will be used for configuring the delivery of
the message.public EventBus publish(String address, Object message)
EventBusThe message will be delivered to all handlers registered to the address.
public EventBus publish(String address, Object message, DeliveryOptions options)
EventBusEventBus.publish(String, Object) but specifying options that can be used to configure the delivery.public <T> MessageConsumer<T> consumer(String address)
EventBus
The returned consumer is not yet registered
at the address, registration will be effective when MessageConsumer.handler(io.vertx.core.Handler)
is called.
public <T> MessageConsumer<T> consumer(String address, Handler<Message<T>> handler)
EventBuspublic <T> MessageConsumer<T> localConsumer(String address)
EventBusEventBus.consumer(String) but the address won't be propagated across the cluster.localConsumer in interface EventBusaddress - the address to register it atpublic <T> MessageConsumer<T> localConsumer(String address, Handler<Message<T>> handler)
EventBusEventBus.consumer(String, Handler) but the address won't be propagated across the cluster.localConsumer in interface EventBusaddress - the address that will register it athandler - the handler that will process the received messagespublic EventBus registerCodec(MessageCodec codec)
EventBusYou 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.
registerCodec in interface EventBuscodec - the message codec to registerpublic EventBus unregisterCodec(String name)
EventBusunregisterCodec in interface EventBusname - the name of the codecpublic <T> EventBus registerDefaultCodec(Class<T> clazz, MessageCodec<T,?> codec)
EventBusYou 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.
Default message codecs will be used to serialise any messages of the specified type on the event bus without the codec having to be specified in the delivery options.
registerDefaultCodec in interface EventBusclazz - the class for which to use this codeccodec - the message codec to registerpublic EventBus unregisterDefaultCodec(Class clazz)
EventBusunregisterDefaultCodec in interface EventBusclazz - the class for which the codec was registeredpublic void close(Handler<AsyncResult<Void>> completionHandler)
EventBuspublic boolean isMetricsEnabled()
MeasuredisMetricsEnabled in interface Measuredpublic EventBusMetrics<?> getMetrics()
MetricsProvidergetMetrics in interface MetricsProviderCopyright © 2015. All Rights Reserved.