io.vertx.amqp

## Interface AmqpSender

- All Superinterfaces:
    StreamBase, WriteStream<AmqpMessage>

      public interface AmqpSender
      extends WriteStream<AmqpMessage>

  AMQP Sender interface used to send messages.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `address()`
    `void` | `close(Handler<AsyncResult<Void>> handler)` Closes the sender.
    `AmqpConnection` | `connection()` Gets the connection having created the sender.
    `AmqpSender` | `exceptionHandler(Handler<Throwable> handler)` Set an exception handler on the write stream.
    `AmqpSender` | `send(AmqpMessage message)` Sends an AMQP message.
    `AmqpSender` | `sendWithAck(AmqpMessage message, Handler<AsyncResult<Void>> acknowledgementHandler)` Sends an AMQP message and waits for an acknowledgement.
    `AmqpSender` | `setWriteQueueMaxSize(int maxSize)` Set the maximum size of the write queue to `maxSize`.
    `AmqpSender` | `write(AmqpMessage data)` Write some data to the stream.
    `AmqpSender` | `write(AmqpMessage data, Handler<AsyncResult<Void>> handler)` Same as `#write(T)` but with an `handler` called when the operation completes

    - ### Methods inherited from interface io.vertx.core.streams.WriteStream

      `drainHandler, end, end, end, end, writeQueueFull`

- - ### Method Detail

    - #### write

          AmqpSender write(AmqpMessage data)

      Description copied from interface: `WriteStream`
      Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the `WriteStream.writeQueueFull()` method before writing. This is done automatically if using a `Pump`.
      Specified by:
        `write` in interface `WriteStream<AmqpMessage>`
      Parameters:
        `data` - the data to write
      Returns:
        a reference to this, so the API can be used fluently

    - #### write

          AmqpSender write(AmqpMessage data,
                           Handler<AsyncResult<Void>> handler)

      Description copied from interface: `WriteStream`
      Same as `#write(T)` but with an `handler` called when the operation completes
      Specified by:
        `write` in interface `WriteStream<AmqpMessage>`

    - #### exceptionHandler

          AmqpSender exceptionHandler(Handler<Throwable> handler)

      Description copied from interface: `WriteStream`
      Set an exception handler on the write stream.
      Specified by:
        `exceptionHandler` in interface `StreamBase`
      Specified by:
        `exceptionHandler` in interface `WriteStream<AmqpMessage>`
      Parameters:
        `handler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### setWriteQueueMaxSize

          AmqpSender setWriteQueueMaxSize(int maxSize)

      Description copied from interface: `WriteStream`
      Set the maximum size of the write queue to `maxSize`. You will still be able to write to the stream even if there is more than `maxSize` items in the write queue. This is used as an indicator by classes such as `Pump` to provide flow control.

      The value is defined by the implementation of the stream, e.g in bytes for a `NetSocket`, the number of `Message` for a `MessageProducer`, etc...
      Specified by:
        `setWriteQueueMaxSize` in interface `WriteStream<AmqpMessage>`
      Parameters:
        `maxSize` - the max size of the write stream
      Returns:
        a reference to this, so the API can be used fluently

    - #### send

          AmqpSender send(AmqpMessage message)

      Sends an AMQP message. The destination the configured sender address or the address configured in the message.
      Parameters:
        `message` - the message, must not be `null`
      Returns:
        the current sender

    - #### sendWithAck

          AmqpSender sendWithAck(AmqpMessage message,
                                 Handler<AsyncResult<Void>> acknowledgementHandler)

      Sends an AMQP message and waits for an acknowledgement. The acknowledgement handler is called with an `AsyncResult` marked as failed if the message has been rejected or re-routed. If the message has been accepted, the handler is called with a success.
      Parameters:
        `message` - the message, must not be `null`
        `acknowledgementHandler` - the acknowledgement handler, must not be `null`
      Returns:
        the current sender

    - #### close

          void close(Handler<AsyncResult<Void>> handler)

      Closes the sender.
      Parameters:
        `handler` - called when the sender has been closed, must not be `null`

    - #### address

          String address()

      Returns:
        the configured address.

    - #### connection

          AmqpConnection connection()

      Gets the connection having created the sender. Cannot be `null`
      Returns:
        the connection having created the sender.

Copyright © 2019 Eclipse. All rights reserved.