io.vertx.rabbitmq

## Interface RabbitMQConsumer

- All Superinterfaces:
    ReadStream<RabbitMQMessage>, StreamBase

      public interface RabbitMQConsumer
      extends ReadStream<RabbitMQMessage>

  A stream of messages from a rabbitmq queue.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Future<Void>` | `cancel()` Stop message consumption from a queue.
    `void` | `cancel(Handler<AsyncResult<Void>> cancelResult)` Stop message consumption from a queue.
    `String` | `consumerTag()`
    `RabbitMQConsumer` | `endHandler(Handler<Void> endHandler)` Set an end handler.
    `RabbitMQConsumer` | `exceptionHandler(Handler<Throwable> exceptionHandler)` Set an exception handler on the read stream.
    `RabbitMQConsumer` | `fetch(long amount)` Fetch the specified `amount` of elements.
    `RabbitMQConsumer` | `handler(Handler<RabbitMQMessage> messageArrived)` Set a message handler.
    `boolean` | `isCancelled()` Return `true` if cancel() has been called.
    `boolean` | `isPaused()`
    `RabbitMQConsumer` | `pause()` Pause the stream of incoming messages from queue.
    `String` | `queueName()`
    `RabbitMQConsumer` | `resume()` Resume reading from a queue.
    `RabbitMQConsumer` | `setQueueName(String name)` Set the name of the queue.

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

      `pipe, pipeTo, pipeTo`

- - ### Method Detail

    - #### exceptionHandler

          RabbitMQConsumer exceptionHandler(Handler<Throwable> exceptionHandler)

      Set an exception handler on the read stream.
      Specified by:
        `exceptionHandler` in interface `ReadStream<RabbitMQMessage>`
      Specified by:
        `exceptionHandler` in interface `StreamBase`
      Parameters:
        `exceptionHandler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### handler

          RabbitMQConsumer handler(Handler<RabbitMQMessage> messageArrived)

      Set a message handler. As message appear in a queue, the handler will be called with the message.
      Specified by:
        `handler` in interface `ReadStream<RabbitMQMessage>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### pause

          RabbitMQConsumer pause()

      Pause the stream of incoming messages from queue.

      The messages will continue to arrive, but they will be stored in a internal queue. If the queue size would exceed the limit provided by `RabbitMQConsumer#size(int)`, then incoming messages will be discarded.

      Specified by:
        `pause` in interface `ReadStream<RabbitMQMessage>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### resume

          RabbitMQConsumer resume()

      Resume reading from a queue. Flushes internal queue.
      Specified by:
        `resume` in interface `ReadStream<RabbitMQMessage>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### endHandler

          RabbitMQConsumer endHandler(Handler<Void> endHandler)

      Set an end handler. Once the stream has canceled successfully, the handler will be called.
      Specified by:
        `endHandler` in interface `ReadStream<RabbitMQMessage>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### queueName

          String queueName()

      Returns:
        the name of the queue

    - #### setQueueName

          RabbitMQConsumer setQueueName(String name)

      Set the name of the queue. This method is typically only required during a connectionEstablishedCallback when the queue name has changed.
      Parameters:
        `name` - the name of the queue
      Returns:
        a reference to this, so the API can be used fluently

    - #### consumerTag

          String consumerTag()

      Returns:
        a consumer tag

    - #### cancel

          Future<Void> cancel()

      Stop message consumption from a queue.

      The operation is asynchronous. When consumption is stopped, you can also be notified via `endHandler(Handler)`

      Returns:
        a future through which you can find out the operation status.

    - #### cancel

          void cancel(Handler<AsyncResult<Void>> cancelResult)

      Stop message consumption from a queue.

      The operation is asynchronous. When consumption is stopped, you can also be notified via `endHandler(Handler)`

      Parameters:
        `cancelResult` - contains information about operation status: success/fail.

    - #### isCancelled

          boolean isCancelled()

      Return `true` if cancel() has been called.
      Returns:
        `true` if cancel() has been called.

    - #### isPaused

          boolean isPaused()

      Returns:
        is the stream paused?

    - #### fetch

          RabbitMQConsumer fetch(long amount)

      Fetch the specified `amount` of elements. If the `ReadStream` has been paused, reading will recommence with the specified `amount` of items, otherwise the specified `amount` will be added to the current stream demand.
      Specified by:
        `fetch` in interface `ReadStream<RabbitMQMessage>`
      Returns:
        a reference to this, so the API can be used fluently

Copyright © 2023 Eclipse. All rights reserved.