RMQ - RabbitMQ C++ Library
Classes | Public Types | Public Member Functions | List of all members
BloombergLP::rmqa::ConsumerImpl Class Reference
Inheritance diagram for BloombergLP::rmqa::ConsumerImpl:
Inheritance graph
[legend]
Collaboration diagram for BloombergLP::rmqa::ConsumerImpl:
Collaboration graph
[legend]

Classes

class  Factory
 

Public Types

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

Public Member Functions

 ConsumerImpl (const bsl::shared_ptr< rmqamqp::ReceiveChannel > &channel, rmqt::QueueHandle queue, const bsl::shared_ptr< ConsumerFunc > &onMessage, const bsl::string &consumerTag, bdlmt::ThreadPool &threadPool, rmqio::EventLoop &eventLoop, const bsl::shared_ptr< rmqt::ConsumerAckQueue > &ackQueue, const bsl::shared_ptr< rmqa::MessageGuard::Factory > &messageGuardFactory, const bsl::vector< bsl::shared_ptr< rmqp::MessageTransformer > > &transformers)
 
 ~ConsumerImpl ()
 Destructor stops the consumer.
 
rmqt::Result start ()
 
rmqt::Future cancel () BSLS_KEYWORD_OVERRIDE
 Cancels the consumer, stops new messages flowing in. More...
 
rmqt::Future drain () BSLS_KEYWORD_OVERRIDE
 
rmqt::Result cancelAndDrain (const bsls::TimeInterval &timeout) BSLS_KEYWORD_OVERRIDE
 Tells the broker to stop delivering messages to this consumer. More...
 
rmqt::Future updateTopologyAsync (const rmqt::TopologyUpdate &topologyUpdate) BSLS_KEYWORD_OVERRIDE
 Updates topology. More...
 

Member Typedef Documentation

◆ ConsumerFunc

typedef bsl::function<void(rmqp::MessageGuard&)> BloombergLP::rmqp::Consumer::ConsumerFunc
inherited

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()

rmqt::Future BloombergLP::rmqa::ConsumerImpl::cancel ( )
virtual

Cancels the consumer, stops new messages flowing in.

Implements BloombergLP::rmqp::Consumer.

◆ cancelAndDrain()

rmqt::Result BloombergLP::rmqa::ConsumerImpl::cancelAndDrain ( const bsls::TimeInterval &  timeout)
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.

Implements BloombergLP::rmqp::Consumer.

◆ drain()

rmqt::Future BloombergLP::rmqa::ConsumerImpl::drain ( )
virtual

return a future to wait for consumer to ack all the outstanding messages

Implements BloombergLP::rmqp::Consumer.

◆ updateTopologyAsync()

rmqt::Future BloombergLP::rmqa::ConsumerImpl::updateTopologyAsync ( const rmqt::TopologyUpdate topologyUpdate)
virtual

Updates topology.

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

Implements BloombergLP::rmqp::Consumer.


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