RMQ - RabbitMQ C++ Library
Public Types | Public Member Functions | List of all members
BloombergLP::rmqp::Consumer Class Referenceabstract

Provide a RabbitMQ Async Consumer API. More...

#include <rmqp_consumer.h>

Inheritance diagram for BloombergLP::rmqp::Consumer:
Inheritance graph
[legend]

Public Types

typedef bsl::function< void(rmqp::MessageGuard &)> ConsumerFunc
 Callback function used to receive messages. More...
 

Public Member Functions

 Consumer ()
 Consumer is constructed from the Connection object.
 
virtual rmqt::Future cancel ()=0
 Cancels the consumer, stops new messages flowing in. More...
 
virtual rmqt::Future drain ()=0
 Can only be called (successfully) once the Consumer has been cancelled, returns a future which resolves when all outstanding acks have been sent to the server,. More...
 
virtual rmqt::Result cancelAndDrain (const bsls::TimeInterval &timeout)=0
 Tells the broker to stop delivering messages to this consumer. More...
 
virtual rmqt::Future updateTopologyAsync (const rmqt::TopologyUpdate &topologyUpdate)=0
 Updates topology. More...
 

Detailed Description

Provide a RabbitMQ Async Consumer API.

Consumer represents a RabbitMQ consumer in a dedicated channel on the Connection. The Consumer::Consumer implementation passed to Connection::createConsumer is invoked on each message sent by the broker

Member Typedef Documentation

◆ ConsumerFunc

Callback function used to receive messages.

The passed implementation is invoked on each message received from the broker. rmqp::MessageGuard is used to pass positive or negative acknowledgments to the broker after processing. The callback will always be invoked from the RabbitContext threadpool.

Member Function Documentation

◆ cancel()

virtual rmqt::Future BloombergLP::rmqp::Consumer::cancel ( )
pure virtual

Cancels the consumer, stops new messages flowing in.

Returns
A Future which, when resolved, confirms that the server won't send any more messages.

Implemented in BloombergLP::rmqa::ConsumerImpl.

◆ cancelAndDrain()

virtual rmqt::Result BloombergLP::rmqp::Consumer::cancelAndDrain ( const bsls::TimeInterval &  timeout)
pure virtual

Tells the broker to stop delivering messages to this consumer.

Parameters
timeoutHow long to wait for all delivered (unacked) messages to be processed by the user provided callback. If timeout is 0, the method will wait indefinitely for them to complete, unless the client is disconnected from the broker in between.
Returns
a result once all of the remaining messages have been n/acked by the consuming code, or error otherwise e.g. timeout
Deprecated:
Note
this relies on the consumer code processing all of the outstanding messages.

Implemented in BloombergLP::rmqa::ConsumerImpl.

◆ drain()

virtual rmqt::Future BloombergLP::rmqp::Consumer::drain ( )
pure virtual

Can only be called (successfully) once the Consumer has been cancelled, returns a future which resolves when all outstanding acks have been sent to the server,.

Note
: this relies on the consumer code processing all of the outstanding messages received.

Implemented in BloombergLP::rmqa::ConsumerImpl.

◆ updateTopologyAsync()

virtual rmqt::Future BloombergLP::rmqp::Consumer::updateTopologyAsync ( const rmqt::TopologyUpdate topologyUpdate)
pure virtual

Updates topology.

Returns
A Future which, when resolved, will contain the result of the update.

Implemented in BloombergLP::rmqa::ConsumerImpl.


The documentation for this class was generated from the following files: