interface EventBus : Measured
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.
Author
Tim Fox
abstract fun addInterceptor(interceptor: Handler<SendContext<Any>>): EventBus
Add an interceptor that will be called whenever a message is sent from Vert.x |
|
abstract fun close(completionHandler: Handler<AsyncResult<Void>>): Unit
Close the event bus and release any resources held. This would not normally be called in user code |
|
abstract fun <T : Any> consumer(address: String): MessageConsumer<T>
Create a message consumer against the specified address. The returned consumer is not yet registered at the address, registration will be effective when abstract fun <T : Any> consumer(address: String, handler: Handler<Message<T>>): MessageConsumer<T>
Create a consumer and register it against the specified address. |
|
abstract fun <T : Any> localConsumer(address: String): MessageConsumer<T>
Like abstract fun <T : Any> localConsumer(address: String, handler: Handler<Message<T>>): MessageConsumer<T>
Like |
|
abstract fun publish(address: String, message: Any): EventBus
Publish a message. The message will be delivered to all handlers registered to the address. abstract fun publish(address: String, message: Any, options: DeliveryOptions): EventBus
Like |
|
abstract fun <T : Any> publisher(address: String): MessageProducer<T>
Create a message publisher against the specified address. The returned publisher will invoke the abstract fun <T : Any> publisher(address: String, options: DeliveryOptions): MessageProducer<T>
Like |
|
abstract fun registerCodec(codec: MessageCodec<Any, Any>): EventBus
Register a message 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. |
|
abstract fun <T : Any> registerDefaultCodec(clazz: Class<T>, codec: MessageCodec<T, *>): EventBus
Register a default message 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. 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. |
|
abstract fun removeInterceptor(interceptor: Handler<SendContext<Any>>): EventBus
Remove an interceptor |
|
abstract fun send(address: String, message: Any): EventBus
Sends a message. The message will be delivered to at most one of the handlers registered to the address. abstract fun <T : Any> send(address: String, message: Any, replyHandler: Handler<AsyncResult<Message<T>>>): EventBus
Like abstract fun send(address: String, message: Any, options: DeliveryOptions): EventBus
Like abstract fun <T : Any> send(address: String, message: Any, options: DeliveryOptions, replyHandler: Handler<AsyncResult<Message<T>>>): EventBus
Like |
|
abstract fun <T : Any> sender(address: String): MessageProducer<T>
Create a message sender against the specified address. The returned sender will invoke the abstract fun <T : Any> sender(address: String, options: DeliveryOptions): MessageProducer<T>
Like |
|
abstract fun start(completionHandler: Handler<AsyncResult<Void>>): Unit
Start the event bus. This would not normally be called in user code |
|
abstract fun unregisterCodec(name: String): EventBus
Unregister a message codec. |
|
abstract fun unregisterDefaultCodec(clazz: Class<Any>): EventBus
Unregister a default message codec. |