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.

no subtypes hierarchy

Initializer
EventBus(EventBus unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
addInterceptorshared default EventBus addInterceptor(Anything(SendContext<unknown>) interceptor)

Add an interceptor that will be called whenever a message is sent from Vert.x

Parameters:
  • interceptor

    the interceptor

consumershared default MessageConsumer<T?> consumer<T>(String address)

Create a message consumer against the specified address.

The returned consumer is not yet registered at the address, registration will be effective when handler is called.

Parameters:
  • address

    the address that it will register it at

consumershared default MessageConsumer<T?> consumer<T>(String address, Anything(Message<T?>) handler)

Create a consumer and register it against the specified address.

Parameters:
  • address

    the address that will register it at

  • handler

    the handler that will process the received messages

isMetricsEnabledshared actual default Boolean isMetricsEnabled()

Whether the metrics are enabled for this measured object

localConsumershared default MessageConsumer<T?> localConsumer<T>(String address)

Like consumer but the address won't be propagated across the cluster.

Parameters:
  • address

    the address to register it at

localConsumershared default MessageConsumer<T?> localConsumer<T>(String address, Anything(Message<T?>) handler)

Like consumer but the address won't be propagated across the cluster.

Parameters:
  • address

    the address that will register it at

  • handler

    the handler that will process the received messages

publishshared default EventBus publish(String address, Object? message)

Publish a message.

The message will be delivered to all handlers registered to the address.

Parameters:
  • address

    the address to publish it to

  • message

    the message, may be null

publishshared default EventBus publish(String address, Object? message, DeliveryOptions options)

Like publish but specifying options that can be used to configure the delivery.

Parameters:
  • address

    the address to publish it to

  • message

    the message, may be null

  • options

    the delivery options

publishershared default MessageProducer<T?> publisher<T>(String address)

Create a message publisher against the specified address.

The returned publisher will invoke the publish method when the stream write method is called with the publisher address and the provided data.

Parameters:
  • address

    The address to publish it to

publishershared default MessageProducer<T?> publisher<T>(String address, DeliveryOptions options)

Like publisher but specifying delivery options that will be used for configuring the delivery of the message.

Parameters:
  • address

    the address to publish it to

  • options

    the delivery options

removeInterceptorshared default EventBus removeInterceptor(Anything(SendContext<unknown>) interceptor)

Remove an interceptor

Parameters:
  • interceptor

    the interceptor

sendshared default EventBus send(String address, Object? message)

Sends a message.

The message will be delivered to at most one of the handlers registered to the address.

Parameters:
  • address

    the address to send it to

  • message

    the message, may be null

sendshared default EventBus send(String address, Object? message, DeliveryOptions options)

Like send but specifying options that can be used to configure the delivery.

Parameters:
  • address

    the address to send it to

  • message

    the message, may be null

  • options

    delivery options

sendshared default EventBus send<T>(String address, Object? message, Anything(Throwable|Message<T?>) replyHandler)

Like send but specifying a replyHandler that will be called if the recipient subsequently replies to the message.

Parameters:
  • address

    the address to send it to

  • message

    the message, may be null

  • replyHandler

    reply handler will be called when any reply from the recipient is received, may be null

sendshared default EventBus send<T>(String address, Object? message, DeliveryOptions options, Anything(Throwable|Message<T?>) replyHandler)

Like send but specifying a replyHandler that will be called if the recipient subsequently replies to the message.

Parameters:
  • address

    the address to send it to

  • message

    the message, may be null

  • options

    delivery options

  • replyHandler

    reply handler will be called when any reply from the recipient is received, may be null

sendershared default MessageProducer<T?> sender<T>(String address)

Create a message sender against the specified address.

The returned sender will invoke the send method when the stream write method is called with the sender address and the provided data.

Parameters:
  • address

    the address to send it to

sendershared default MessageProducer<T?> sender<T>(String address, DeliveryOptions options)

Like sender but specifying delivery options that will be used for configuring the delivery of the message.

Parameters:
  • address

    the address to send it to

  • options

    the delivery options

Inherited Methods
Methods inherited from: Object
equals
Methods inherited from: Measured