# file: consumer.aus

## class: RabbitMqConsumer

[33:14] (extern: com.lehman.aussom.RabbitMqConsumer) **extends: object** 

Synchronous pull consumer created with channel.consume(). The
broker pushes deliveries into an internal buffer; receive() drains
them one at a time on the calling thread.
With manual acks (AutoAck false) plus qos(prefetch) on the channel,
the broker never sends more than the prefetch window
unacknowledged, so a slow consumer applies real back-pressure.
Acknowledge through the received message (Msg.ack()) or the
channel. Asynchronous push into callbacks goes through
RabbitMqListener instead, which runs under the Aussom Server
listener runtime.

#### Methods

- **RabbitMqConsumer** ()


- **receive** (`int TimeoutMs = 0`)

	> Receives the next message, blocking up to the timeout.

	- **@p** `TimeoutMs` is an int with how long to wait (default 0 = wait forever).
	- **@r** `A` RabbitMqMessage object, or null when the timeout expires.


- **receiveNoWait** ()

	> Returns the next message if one is buffered right now. Never blocks.

	- **@r** `A` RabbitMqMessage object, or null.


- **getConsumerTag** ()

	> Gets the consumer tag (broker-assigned when none was provided to consume()).

	- **@r** `A` string with the consumer tag.


- **isCancelled** ()

	> Reports whether the broker cancelled this consumer from its side, for example because the queue was deleted.

	- **@r** `A` bool with true after a broker-side cancel.


- **cancel** ()

	> Cancels the consumer. Buffered undispatched messages are requeued on the broker when the consumer was manual-ack. Safe to call more than once.

	- **@r** `this` object




