RMQ - RabbitMQ C++ Library
Public Member Functions | List of all members
BloombergLP::rmqa::Consumer Class Reference

Provide a RabbitMQ Async Consumer API. More...

#include <rmqa_consumer.h>

Public Member Functions

 Consumer (bslma::ManagedPtr< rmqp::Consumer > &impl)
 
void cancel ()
 Tells the broker to stop delivering messages to this consumer. it's still possible to nack/ack messages from callbacks after cancel is called.
 
rmqt::Result cancelAndDrain (const bsls::TimeInterval &timeout=bsls::TimeInterval(0))
 Tells the broker to stop delivering messages to this consumer. More...
 
rmqt::Result updateTopology (const rmqa::TopologyUpdate &topologyUpdate, const bsls::TimeInterval &timeout=bsls::TimeInterval(0))
 
 ~Consumer ()
 Destructor stops the consumer.
 

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

Constructor & Destructor Documentation

◆ Consumer()

BloombergLP::rmqa::Consumer::Consumer ( bslma::ManagedPtr< rmqp::Consumer > &  impl)
explicit

Create an instance of a Consumer that will operate through the supplied async consumer implementation. The Consumer object takes ownership of the supplied asynchronous consumer implementation. Consumer should generally be constructed via Connection::createConsumer.

Member Function Documentation

◆ cancelAndDrain()

rmqt::Result BloombergLP::rmqa::Consumer::cancelAndDrain ( const bsls::TimeInterval &  timeout = bsls::TimeInterval(0))

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
Warning
This should never be called from a message processing callback
Note
this relies on the consumer code processing all of the outstanding messages

◆ updateTopology()

rmqt::Result BloombergLP::rmqa::Consumer::updateTopology ( const rmqa::TopologyUpdate topologyUpdate,
const bsls::TimeInterval &  timeout = bsls::TimeInterval(0) 
)

Updates topology and waits for the server to confirm the update status

Parameters
timeoutHow long to wait for. If timeout is 0, the method will indefinitely wait for confirms.
Returns
truthy if all outstanding confirms have arrived.
falsey if update failed or waiting timed out, with an associated error message.

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