Package: io.vertx.groovy.core.eventbus

## [Groovy] Class Message<T>

- io.vertx.groovy.core.eventbus.Message

- Represents a message that is received from the event bus in a handler.

  Messages have a Message.body, which can be null, and also Message.headers, which can be empty.

  If the message was sent specifying a reply handler it will also have a Message.replyAddress. In that case the message can be replied to using that reply address, or, more simply by just using Message.reply.

  If you want to notify the sender that processing failed, then Message.fail can be called.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `Message (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `java.lang.String` | `address()` The address the message was sent to @return
    `T` | `body()` The body of the message.
    `void` | `fail(int failureCode, java.lang.String message)` Signal to the sender that processing of this message failed.
    `java.lang.Object` | `getDelegate()`
    `MultiMap` | `headers()` Multi-map of message headers.
    `void` | `reply(java.lang.Object message)` Reply to this message.
    `void` | `reply(java.lang.Object message, io.vertx.core.Handler<io.vertx.core.AsyncResult<Message<R>>> replyHandler)` The same as `reply(R message)` but you can specify handler for the reply - i.e.
    `void` | `reply(java.lang.Object message, java.util.Map<java.lang.String, java.lang.Object> options)` Link Message.reply but allows you to specify delivery options for the reply.
    `void` | `reply(java.lang.Object message, java.util.Map<java.lang.String, java.lang.Object> options, io.vertx.core.Handler<io.vertx.core.AsyncResult<Message<R>>> replyHandler)` The same as `reply(R message, DeliveryOptions)` but you can specify handler for the reply - i.e.
    `java.lang.String` | `replyAddress()` The reply address.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### Message(java.lang.Object delegate)

  - ### Method Detail

    - #### java.lang.String address()

      The address the message was sent to

      Returns:

    - #### T body()

      The body of the message. Can be null.

      Returns:
        the body, or null.

    - #### void fail(int failureCode, java.lang.String message)

      Signal to the sender that processing of this message failed.

      If the message was sent specifying a result handler the handler will be called with a failure corresponding to the failure code and message specified here.

      Parameters:
        `failureCode` - A failure code to pass back to the sender
        `message` - A message to pass back to the sender

    - #### java.lang.Object getDelegate()

    - #### MultiMap headers()

      Multi-map of message headers. Can be empty

      Returns:
        the headers

    - #### void reply(java.lang.Object message)

      Reply to this message.

      If the message was sent specifying a reply handler, that handler will be called when it has received a reply. If the message wasn't sent specifying a receipt handler this method does nothing.

      Parameters:
        `message` - the message to reply with.

    - #### void reply(java.lang.Object message, io.vertx.core.Handler<io.vertx.core.AsyncResult<Message<R>>> replyHandler)

      The same as `reply(R message)` but you can specify handler for the reply - i.e. to receive the reply to the reply.

      Parameters:
        `message` - the message to reply with.
        `replyHandler` - the reply handler for the reply.

    - #### void reply(java.lang.Object message, java.util.Map<java.lang.String, java.lang.Object> options)

      Link Message.reply but allows you to specify delivery options for the reply.

      Parameters:
        `message` - the reply message
        `options` - the delivery options (see DeliveryOptions)

    - #### void reply(java.lang.Object message, java.util.Map<java.lang.String, java.lang.Object> options, io.vertx.core.Handler<io.vertx.core.AsyncResult<Message<R>>> replyHandler)

      The same as `reply(R message, DeliveryOptions)` but you can specify handler for the reply - i.e. to receive the reply to the reply.

      Parameters:
        `message` - the reply message
        `options` - the delivery options (see DeliveryOptions)
        `replyHandler` - the reply handler for the reply.

    - #### java.lang.String replyAddress()

      The reply address. Can be null.

      Returns:
        the reply address, or null, if message was sent without a reply handler.