io.vertx.rxjava.core.eventbus

## Class EventBus

- java.lang.Object
- - io.vertx.rxjava.core.eventbus.EventBus

- All Implemented Interfaces:
    Measured

      public class EventBus
      extends Object
      implements 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.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EventBus(EventBus delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close(Handler<AsyncResult<Void>> completionHandler)` Close the event bus and release any resources held
    `rx.Observable<Void>` | `closeObservable()` 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.
    `Object` | `getDelegate()`
    `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 `publish(java.lang.String, java.lang.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 `publisher(java.lang.String)` but specifying delivery options that will be used for configuring the delivery of the message.
    `EventBus` | `send(String address, Object message)` Sends a message.
    `<T> EventBus` | `send(String address, Object message, DeliveryOptions options)` Like `EventBus` 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 `send(java.lang.String, java.lang.Object)` 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 `send(java.lang.String, java.lang.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 `sender(java.lang.String)` but specifying delivery options that will be used for configuring the delivery of the message.
    `<T> rx.Observable<Message<T>>` | `sendObservable(String address, Object message)` Like `send(java.lang.String, java.lang.Object)` but specifying a `replyHandler` that will be called if the recipient subsequently replies to the message.
    `<T> rx.Observable<Message<T>>` | `sendObservable(String address, Object message, DeliveryOptions options)` Like `send(java.lang.String, java.lang.Object)` but specifying a `replyHandler` that will be called if the recipient subsequently replies to the message.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.rxjava.core.metrics.Measured

      `newInstance`

- - ### Constructor Detail

    - #### EventBus

          public EventBus(EventBus delegate)

  - ### Method Detail

    - #### getDelegate

          public Object getDelegate()

      Specified by:
        `getDelegate` in interface `Measured`

    - #### isMetricsEnabled

          public boolean isMetricsEnabled()

      Whether the metrics are enabled for this measured object
      Specified by:
        `isMetricsEnabled` in interface `Measured`
      Returns:
        true if the metrics are enabled

    - #### send

          public 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`
      Returns:
        a reference to this, so the API can be used fluently

    - #### send

          public <T> EventBus send(String address,
                                   Object message,
                                   Handler<AsyncResult<Message<T>>> replyHandler)

      Like `send(java.lang.String, java.lang.Object)` 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`
      Returns:
        a reference to this, so the API can be used fluently

    - #### sendObservable

          public <T> rx.Observable<Message<T>> sendObservable(String address,
                                                              Object message)

      Like `send(java.lang.String, java.lang.Object)` 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`
      Returns:

    - #### send

          public <T> EventBus send(String address,
                                   Object message,
                                   DeliveryOptions options)

      Like `EventBus` 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
      Returns:
        a reference to this, so the API can be used fluently

    - #### send

          public <T> EventBus send(String address,
                                   Object message,
                                   DeliveryOptions options,
                                   Handler<AsyncResult<Message<T>>> replyHandler)

      Like `send(java.lang.String, java.lang.Object)` 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`
      Returns:
        a reference to this, so the API can be used fluently

    - #### sendObservable

          public <T> rx.Observable<Message<T>> sendObservable(String address,
                                                              Object message,
                                                              DeliveryOptions options)

      Like `send(java.lang.String, java.lang.Object)` 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
      Returns:

    - #### publish

          public 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`
      Returns:
        a reference to this, so the API can be used fluently

    - #### publish

          public EventBus publish(String address,
                                  Object message,
                                  DeliveryOptions options)

      Like `publish(java.lang.String, java.lang.Object)` 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
      Returns:
        a reference to this, so the API can be used fluently

    - #### consumer

          public <T> MessageConsumer<T> consumer(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 `MessageConsumer.handler(io.vertx.core.Handler<io.vertx.rxjava.core.eventbus.Message<T>>)` is called.

      Parameters:
        `address` - the address that it will register it at
      Returns:
        the event bus message consumer

    - #### consumer

          public <T> MessageConsumer<T> consumer(String address,
                                                 Handler<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
      Returns:
        the event bus message consumer

    - #### localConsumer

          public <T> MessageConsumer<T> localConsumer(String address)

      Like `consumer(java.lang.String)` but the address won't be propagated across the cluster.
      Parameters:
        `address` - the address to register it at
      Returns:
        the event bus message consumer

    - #### localConsumer

          public <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.
      Parameters:
        `address` - the address that will register it at
        `handler` - the handler that will process the received messages
      Returns:
        the event bus message consumer

    - #### sender

          public <T> MessageProducer<T> sender(String address)

      Create a message sender against the specified address.

      The returned sender will invoke the `send(java.lang.String, java.lang.Object)` method when the stream `WriteStream.write(T)` method is called with the sender address and the provided data.

      Parameters:
        `address` - the address to send it to
      Returns:
        The sender

    - #### sender

          public <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.
      Parameters:
        `address` - the address to send it to
        `options` - the delivery options
      Returns:
        The sender

    - #### publisher

          public <T> MessageProducer<T> publisher(String address)

      Create a message publisher against the specified address.

      The returned publisher will invoke the `publish(java.lang.String, java.lang.Object)` method when the stream `WriteStream.write(T)` method is called with the publisher address and the provided data.

      Parameters:
        `address` - The address to publish it to
      Returns:
        The publisher

    - #### publisher

          public <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.
      Parameters:
        `address` - the address to publish it to
        `options` - the delivery options
      Returns:
        The publisher

    - #### close

          public void close(Handler<AsyncResult<Void>> completionHandler)

      Close the event bus and release any resources held
      Parameters:
        `completionHandler` - may be `null`

    - #### closeObservable

          public rx.Observable<Void> closeObservable()

      Close the event bus and release any resources held
      Returns:

    - #### newInstance

          public static EventBus newInstance(EventBus arg)

Copyright © 2015. All Rights Reserved.