RMQ - RabbitMQ C++ Library
Public Types | Public Member Functions | Static Public Member Functions | List of all members
BloombergLP::rmqtestmocks::MockConsumer Class Referenceabstract

Mocks rmqp::Consumer and/or rmqa::Consumer. More...

#include <rmqtestmocks_mockconsumer.h>

Inheritance diagram for BloombergLP::rmqtestmocks::MockConsumer:
Inheritance graph
[legend]
Collaboration diagram for BloombergLP::rmqtestmocks::MockConsumer:
Collaboration graph
[legend]

Public Types

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

Public Member Functions

bsl::shared_ptr< rmqa::Consumerconsumer ()
 
rmqt::Result< rmqp::Consumersuccess ()
 
rmqt::Future< rmqp::ConsumersuccessAsync ()
 
 MOCK_METHOD0 (cancel, rmqt::Future<>())
 
 MOCK_METHOD0 (drain, rmqt::Future<>())
 
 MOCK_METHOD1 (cancelAndDrain, rmqt::Result<>(const bsls::TimeInterval &))
 
 MOCK_METHOD2 (updateTopology, rmqt::Result<>(const rmqt::TopologyUpdate &, const bsls::TimeInterval &))
 
 MOCK_METHOD1 (updateTopologyAsync, rmqt::Future<>(const rmqt::TopologyUpdate &))
 
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...
 

Static Public Member Functions

static rmqt::Result< rmqp::Consumertimeout ()
 
static rmqt::Result< rmqp::Consumererror ()
 
static rmqt::Future< rmqp::ConsumertimeoutAsync ()
 
static rmqt::Future< rmqp::ConsumererrorAsync ()
 

Detailed Description

Mocks rmqp::Consumer and/or rmqa::Consumer.

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

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

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 virtualinherited

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 virtualinherited

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 virtualinherited

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: