org.vertx.java.core.eventbus

## Interface EventBus

-     public interface EventBus

  A distributed lightweight event bus which can encompass multiple vert.x instances. The event bus implements both publish / subscribe network and point to point messaging.

  Messages sent over the event bus are represented by instances of the `Message` class. Subclasses of Message exist for messages that represent all primitive types as well as `String`, `Buffer`, byte[] and `JsonObject`

  For publish / subscribe, messages can be published to an address using one of the `publish(java.lang.String, org.vertx.java.core.json.JsonObject)` methods. An address is a simple `String` instance. Handlers are registered against an address. There can be multiple handlers registered against each address, and a particular handler can be registered against multiple addresses. The event bus will route a sent message to all handlers which are registered against that address.

  For point to point messaging, messages can be sent to an address using one of the `send(java.lang.String, org.vertx.java.core.json.JsonObject, org.vertx.java.core.Handler<org.vertx.java.core.eventbus.Message<org.vertx.java.core.json.JsonObject>>)` methods. The messages will be delivered to a single handler, if one is registered on that address. If more than one handler is registered on the same address, Vert.x will choose one and deliver the message to that. Vert.x will aim to fairly distribute messages in a round-robin way, but does not guarantee strict round-robin under all circumstances.

  All messages sent over the bus are transient. On event of failure of all or part of the event bus messages may be lost. Applications should be coded to cope with lost messages, e.g. by resending them, and making application services idempotent.

  The order of messages received by any specific handler from a specific sender should match the order of messages sent from that sender.

  When sending a message, a reply handler can be provided. If so, it will be called when the reply from the receiver has been received. Reply messages can also be replied to, etc, ad infinitum

  Different event bus instances can be clustered together over a network, to give a single logical event bus.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close(Handler<java.lang.Void> doneHandler)` Close the EventBus and release all resources.
    `void` | `publish(java.lang.String address, java.lang.Boolean message)` Publish a Boolean as a message
    `void` | `publish(java.lang.String address, Buffer message)` Publish a Buffer as a message
    `void` | `publish(java.lang.String address, java.lang.Byte message)` Publish a Byte as a message
    `void` | `publish(java.lang.String address, byte[] message)` Publish a byte[] as a message
    `void` | `publish(java.lang.String address, java.lang.Character message)` Publish a Character as a message
    `void` | `publish(java.lang.String address, java.lang.Double message)` Publish a Double as a message
    `void` | `publish(java.lang.String address, java.lang.Float message)` Publish a Float as a message
    `void` | `publish(java.lang.String address, java.lang.Integer message)` Publish an Integer as a message
    `void` | `publish(java.lang.String address, JsonArray message)` Publish a JSON array as a message
    `void` | `publish(java.lang.String address, JsonObject message)` Publish a JSON object as a message
    `void` | `publish(java.lang.String address, java.lang.Long message)` Publish a Long as a message
    `void` | `publish(java.lang.String address, java.lang.Short message)` Publish a Short as a message
    `void` | `publish(java.lang.String address, java.lang.String message)` Publish a String as a message
    `void` | `registerHandler(java.lang.String address, Handler<? extends Message> handler)` Registers a handler against the specified address
    `void` | `registerHandler(java.lang.String address, Handler<? extends Message> handler, AsyncResultHandler<java.lang.Void> resultHandler)` Registers a handler against the specified address
    `void` | `registerLocalHandler(java.lang.String address, Handler<? extends Message> handler)` Registers a local handler against the specified address.
    `void` | `send(java.lang.String address, java.lang.Boolean message)` Send a Boolean as a message
    `void` | `send(java.lang.String address, java.lang.Boolean message, Handler<Message<java.lang.Boolean>> replyHandler)` Send a Boolean as a message
    `void` | `send(java.lang.String address, Buffer message)` Send a Buffer as a message
    `void` | `send(java.lang.String address, Buffer message, Handler<Message<Buffer>> replyHandler)` Send a Buffer as a message
    `void` | `send(java.lang.String address, java.lang.Byte message)` Send a Byte as a message
    `void` | `send(java.lang.String address, byte[] message)` Send a byte[] as a message
    `void` | `send(java.lang.String address, byte[] message, Handler<Message<byte[]>> replyHandler)` Send a byte[] as a message
    `void` | `send(java.lang.String address, java.lang.Byte message, Handler<Message<java.lang.Byte>> replyHandler)` Send a Byte as a message
    `void` | `send(java.lang.String address, java.lang.Character message)` Send a Character as a message
    `void` | `send(java.lang.String address, java.lang.Character message, Handler<Message<java.lang.Character>> replyHandler)` Send a Character as a message
    `void` | `send(java.lang.String address, java.lang.Double message)` Send a Double as a message
    `void` | `send(java.lang.String address, java.lang.Double message, Handler<Message<java.lang.Double>> replyHandler)` Send a Double as a message
    `void` | `send(java.lang.String address, java.lang.Float message)` Send a Float as a message
    `void` | `send(java.lang.String address, java.lang.Float message, Handler<Message<java.lang.Float>> replyHandler)` Send a Float as a message
    `void` | `send(java.lang.String address, java.lang.Integer message)` Send an Integer as a message
    `void` | `send(java.lang.String address, java.lang.Integer message, Handler<Message<java.lang.Integer>> replyHandler)` Send an Integer as a message
    `void` | `send(java.lang.String address, JsonArray message)` Send a JSON array as a message
    `void` | `send(java.lang.String address, JsonArray message, Handler<Message<JsonArray>> replyHandler)` Send a JSON array as a message
    `void` | `send(java.lang.String address, JsonObject message)` Send a JSON object as a message
    `void` | `send(java.lang.String address, JsonObject message, Handler<Message<JsonObject>> replyHandler)` Send a JSON object as a message
    `void` | `send(java.lang.String address, java.lang.Long message)` Send a Long as a message
    `void` | `send(java.lang.String address, java.lang.Long message, Handler<Message<java.lang.Long>> replyHandler)` Send a Long as a message
    `void` | `send(java.lang.String address, java.lang.Short message)` Send a Short as a message
    `void` | `send(java.lang.String address, java.lang.Short message, Handler<Message<java.lang.Short>> replyHandler)` Send a Short as a message
    `void` | `send(java.lang.String address, java.lang.String message)` Send a String as a message
    `void` | `send(java.lang.String address, java.lang.String message, Handler<Message<java.lang.String>> replyHandler)` Send a String as a message
    `void` | `unregisterHandler(java.lang.String address, Handler<? extends Message> handler)` Unregisters a handler given the address and the handler
    `void` | `unregisterHandler(java.lang.String address, Handler<? extends Message> handler, AsyncResultHandler<java.lang.Void> resultHandler)` Unregisters a handler given the address and the handler

- - ### Method Detail

    - #### close

          void close(Handler<java.lang.Void> doneHandler)

      Close the EventBus and release all resources.
      Parameters:
        `doneHandler` -

    - #### send

          void send(java.lang.String address,
                  JsonObject message,
                  Handler<Message<JsonObject>> replyHandler)

      Send a JSON object as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  JsonObject message)

      Send a JSON object as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  JsonArray message,
                  Handler<Message<JsonArray>> replyHandler)

      Send a JSON array as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  JsonArray message)

      Send a JSON array as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  Buffer message,
                  Handler<Message<Buffer>> replyHandler)

      Send a Buffer as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  Buffer message)

      Send a Buffer as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  byte[] message,
                  Handler<Message<byte[]>> replyHandler)

      Send a byte[] as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  byte[] message)

      Send a byte[] as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.String message,
                  Handler<Message<java.lang.String>> replyHandler)

      Send a String as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.String message)

      Send a String as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.Integer message,
                  Handler<Message<java.lang.Integer>> replyHandler)

      Send an Integer as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.Integer message)

      Send an Integer as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.Long message,
                  Handler<Message<java.lang.Long>> replyHandler)

      Send a Long as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.Long message)

      Send a Long as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.Float message,
                  Handler<Message<java.lang.Float>> replyHandler)

      Send a Float as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.Float message)

      Send a Float as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.Double message,
                  Handler<Message<java.lang.Double>> replyHandler)

      Send a Double as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.Double message)

      Send a Double as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.Boolean message,
                  Handler<Message<java.lang.Boolean>> replyHandler)

      Send a Boolean as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.Boolean message)

      Send a Boolean as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.Short message,
                  Handler<Message<java.lang.Short>> replyHandler)

      Send a Short as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.Short message)

      Send a Short as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.Character message,
                  Handler<Message<java.lang.Character>> replyHandler)

      Send a Character as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.Character message)

      Send a Character as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### send

          void send(java.lang.String address,
                  java.lang.Byte message,
                  Handler<Message<java.lang.Byte>> replyHandler)

      Send a Byte as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message
        `replyHandler` - Reply handler will be called when any reply from the recipient is received

    - #### send

          void send(java.lang.String address,
                  java.lang.Byte message)

      Send a Byte as a message
      Parameters:
        `address` - The address to send it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     JsonObject message)

      Publish a JSON object as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     JsonArray message)

      Publish a JSON array as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     Buffer message)

      Publish a Buffer as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     byte[] message)

      Publish a byte[] as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.String message)

      Publish a String as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.Integer message)

      Publish an Integer as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.Long message)

      Publish a Long as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.Float message)

      Publish a Float as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.Double message)

      Publish a Double as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.Boolean message)

      Publish a Boolean as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.Short message)

      Publish a Short as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.Character message)

      Publish a Character as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### publish

          void publish(java.lang.String address,
                     java.lang.Byte message)

      Publish a Byte as a message
      Parameters:
        `address` - The address to publish it to
        `message` - The message

    - #### unregisterHandler

          void unregisterHandler(java.lang.String address,
                               Handler<? extends Message> handler,
                               AsyncResultHandler<java.lang.Void> resultHandler)

      Unregisters a handler given the address and the handler
      Parameters:
        `address` - The address the handler was registered at
        `handler` - The handler
        `resultHandler` - Optional completion handler. If specified, when the unregister has been propagated to all nodes of the event bus, the handler will be called.

    - #### unregisterHandler

          void unregisterHandler(java.lang.String address,
                               Handler<? extends Message> handler)

      Unregisters a handler given the address and the handler
      Parameters:
        `address` - The address the handler was registered at
        `handler` - The handler

    - #### registerHandler

          void registerHandler(java.lang.String address,
                             Handler<? extends Message> handler,
                             AsyncResultHandler<java.lang.Void> resultHandler)

      Registers a handler against the specified address
      Parameters:
        `address` - The address to register it at
        `handler` - The handler
        `resultHandler` - Optional completion handler. If specified, when the register has been propagated to all nodes of the event bus, the handler will be called.

    - #### registerHandler

          void registerHandler(java.lang.String address,
                             Handler<? extends Message> handler)

      Registers a handler against the specified address
      Parameters:
        `address` - The address to register it at
        `handler` - The handler

    - #### registerLocalHandler

          void registerLocalHandler(java.lang.String address,
                                  Handler<? extends Message> handler)

      Registers a local handler against the specified address. The handler info won't be propagated across the cluster
      Parameters:
        `address` - The address to register it at
        `handler` - The handler