RMQ - RabbitMQ C++ Library
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
BloombergLP::rmqt::ConsumerConfig Class Reference

Class for passing arguments to Consumer. More...

#include <rmqt_consumerconfig.h>

Public Member Functions

 ConsumerConfig (const bsl::string &consumerTag=generateConsumerTag(), uint16_t prefetchCount=s_defaultPrefetchCount, bdlmt::ThreadPool *threadpool=0, rmqt::Exclusive::Value exclusiveFlag=rmqt::Exclusive::OFF, bsl::optional< int64_t > consumerPriority=bsl::optional< int64_t >())
 
const bsl::string & consumerTag () const
 
uint16_t prefetchCount () const
 
bdlmt::ThreadPool * threadpool () const
 
rmqt::Exclusive::Value exclusiveFlag () const
 
bsl::optional< int64_t > consumerPriority () const
 
const bsl::vector< bsl::shared_ptr< rmqp::MessageTransformer > > & transformers () const
 
ConsumerConfigsetConsumerTag (const bsl::string &consumerTag)
 
ConsumerConfigsetPrefetchCount (uint16_t prefetchCount)
 
ConsumerConfigsetThreadpool (bdlmt::ThreadPool *threadpool)
 
ConsumerConfigsetExclusiveFlag (rmqt::Exclusive::Value exclusiveFlag=rmqt::Exclusive::ON)
 
ConsumerConfigsetConsumerPriority (const bsl::optional< int64_t > &consumerPriority)
 
ConsumerConfigaddTransformer (const bsl::shared_ptr< rmqp::MessageTransformer > &transformer)
 

Static Public Member Functions

static bsl::string generateConsumerTag ()
 Util method to generate a default Consumer tag.
 

Static Public Attributes

static const uint16_t s_defaultPrefetchCount = 5
 

Detailed Description

Class for passing arguments to Consumer.

This class provides passing arguments to Consumer.

Constructor & Destructor Documentation

◆ ConsumerConfig()

BloombergLP::rmqt::ConsumerConfig::ConsumerConfig ( const bsl::string &  consumerTag = generateConsumerTag(),
uint16_t  prefetchCount = s_defaultPrefetchCount,
bdlmt::ThreadPool *  threadpool = 0,
rmqt::Exclusive::Value  exclusiveFlag = rmqt::Exclusive::OFF,
bsl::optional< int64_t >  consumerPriority = bsl::optional<int64_t>() 
)
explicit
Parameters
consumerTagA label for the consumer which is displayed on the RabbitMQ Management UI. It is useful to give this a meaningful name.
prefetchCountUsed by the RabbitMQ broker to limit the number of messages held by a consumer at one time. Higher values can increase throughput, particularly in high latency environments.
threadpoolthreadpool which should be used to process consumer (message) callbacks, defaults to using the context level threadpool
exclusiveFlagIndicate to RabbitMQ that this consumer should be the only consumer from the specified queue. This may cause the consumer to remain in a declaration loop if another consumer exists on this queue.
consumerPriorityIndicate to RabbitMQ the priority of the consumer (between 0 and 10, higher is more important) the broker will send to available consumers in terms of priority provided the consumer is available and not blocked (per prefetchCount) see https://www.rabbitmq.com/consumer-priority.html#definitions for more details

Member Function Documentation

◆ addTransformer()

ConsumerConfig & BloombergLP::rmqt::ConsumerConfig::addTransformer ( const bsl::shared_ptr< rmqp::MessageTransformer > &  transformer)
inline
Parameters
transformA message transformer to be undone for each message received by the consumer. Multiple transformers will be called in the inverse order, i.e. the last transformer in added is applied first.

◆ setConsumerPriority()

ConsumerConfig & BloombergLP::rmqt::ConsumerConfig::setConsumerPriority ( const bsl::optional< int64_t > &  consumerPriority)
inline
Parameters
consumerPriorityIndicate to RabbitMQ the priority of the consumer: larger numbers indicate higher priority, and both positive and negative numbers can be used. The broker will send to available consumers in terms of priority provided the consumer is available and not blocked (per prefetchCount) see https://www.rabbitmq.com/consumer-priority.html#definitions for more details

◆ setConsumerTag()

ConsumerConfig & BloombergLP::rmqt::ConsumerConfig::setConsumerTag ( const bsl::string &  consumerTag)
inline
Parameters
consumerTagA label for the consumer which is displayed on the RabbitMQ Management UI. It is useful to give this a meaningful name.

◆ setExclusiveFlag()

ConsumerConfig & BloombergLP::rmqt::ConsumerConfig::setExclusiveFlag ( rmqt::Exclusive::Value  exclusiveFlag = rmqt::Exclusive::ON)
inline
Parameters
exclusiveFlagIndicate to RabbitMQ that this consumer should be the only consumer from the specified queue. This may cause the consumer to remain in a declaration loop if another consumer exists on this queue.

◆ setPrefetchCount()

ConsumerConfig & BloombergLP::rmqt::ConsumerConfig::setPrefetchCount ( uint16_t  prefetchCount)
inline
Parameters
prefetchCountUsed by the RabbitMQ broker to limit the number of messages held by a consumer at one time. Higher values can increase throughput, particularly in high latency environments.

◆ setThreadpool()

ConsumerConfig & BloombergLP::rmqt::ConsumerConfig::setThreadpool ( bdlmt::ThreadPool *  threadpool)
inline
Parameters
threadpoolthreadpool which should be used to process consumer (message) callbacks, defaults to using the context level threadpool. The passed threadpool is not owned by any rmq object and must live longer than this consumer exists on the threadpool, which will be longer than the lifetime of the Consumer object. It's recommended to keep this threadpool alive longer longer than the Context.

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