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

Class for passing arguments to RabbitContext. More...

#include <rmqa_rabbitcontextoptions.h>

Public Types

typedef bsl::set< bsl::string > Tunables
 

Public Member Functions

 RabbitContextOptions ()
 By Default RabbitContext will 1) Create it's own threadpool for calling back to client code e.g. consuming messages, confirming published messages 2) Stub out error notifications - this library retries indefinitely for operations requested of it, set an error handler to be made aware of ongoing retry attempts in order to circuit break the retries for your applications needs 3) Stub out metric publishing, if you would like to publish metrics please provide an implementation that confirms to the MetricPublisher interface.
 
RabbitContextOptionssetThreadpool (bdlmt::ThreadPool *threadpool)
 
RabbitContextOptionssetMetricPublisher (const bsl::shared_ptr< rmqp::MetricPublisher > &metricPublisher)
 
RabbitContextOptionssetErrorCallback (const rmqt::ErrorCallback &errorCallback)
 
RabbitContextOptionssetClientProperty (const bsl::string &name, const rmqt::FieldValue &value)
 
RabbitContextOptionssetMessageProcessingTimeout (const bsls::TimeInterval &timeout)
 Set time in which consumers should process messages. More...
 
RabbitContextOptionssetConnectionErrorThreshold (const bsl::optional< bsls::TimeInterval > &timeout)
 Set time threshold at which point the error callback is called if there has been no success in establishing an amqp connection to the broker. More...
 
RabbitContextOptionssetConsumerTracing (const bsl::shared_ptr< rmqp::ConsumerTracing > &consumerTracing)
 will be called back to create a context which spans for the lifetime of the messageguard before it is passed to its consumer message processor if there has More...
 
RabbitContextOptionssetProducerTracing (const bsl::shared_ptr< rmqp::ProducerTracing > &producerTracing)
 will be called back at message send, with meta data to establish a context, the context will be kept alive until the messageConfirm response callback More...
 
RabbitContextOptionsuseRabbitMQFieldValueEncoding (bool rabbitEncoding)
 DEPRECATED: Previously was used to switch between AMQP-spec and RabbitMQ-spec Field Value encoding. This is now always true.
 
RabbitContextOptionssetShuffleConnectionEndpoints (bool shuffleConnectionEndpoints)
 Shuffle endpoints rmq connects to. By default, boost asio (libc) resolves and connects to the node with longest matching subnet prefix causing disproportionately more connections with certain endpoints. Setting this option will shuffle resolver results. More...
 
bdlmt::ThreadPool * threadpool () const
 
const bsl::shared_ptr< rmqp::MetricPublisher > & metricPublisher () const
 
const rmqt::ErrorCallback & errorCallback () const
 
const rmqt::FieldTableclientProperties () const
 
const bsls::TimeInterval & messageProcessingTimeout () const
 
const bsl::optional< bsls::TimeInterval > & connectionErrorThreshold () const
 
const rmqt::Tunables & tunables () const
 
const bsl::shared_ptr< rmqp::ConsumerTracing > & consumerTracing () const
 
const bsl::shared_ptr< rmqp::ProducerTracing > & producerTracing () const
 
const bsl::optional< bool > & shuffleConnectionEndpoints () const
 

Detailed Description

Class for passing arguments to RabbitContext.

This class provides passing arguments to RabbitContext. It allows specifying the async callback threadpool, metric publisher and error callback. If any of them are not specified, a default value is used.

Member Function Documentation

◆ setClientProperty()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setClientProperty ( const bsl::string &  name,
const rmqt::FieldValue &  value 
)
Parameters
namename of client property to set
valuevalue of client property NOTE: The following properties are set by default and can be overridden: task, pid, os, os_version, os_patch. The following properties are reserved and cannot be overridden: capabilities, platform, product, version, connection_name

◆ setConnectionErrorThreshold()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setConnectionErrorThreshold ( const bsl::optional< bsls::TimeInterval > &  timeout)

Set time threshold at which point the error callback is called if there has been no success in establishing an amqp connection to the broker.

Parameters
timeoutthe timeout value

◆ setConsumerTracing()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setConsumerTracing ( const bsl::shared_ptr< rmqp::ConsumerTracing > &  consumerTracing)

will be called back to create a context which spans for the lifetime of the messageguard before it is passed to its consumer message processor if there has

Parameters
consumerTracingimplements the rmqp::ConsumerTracing protocol

◆ setErrorCallback()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setErrorCallback ( const rmqt::ErrorCallback &  errorCallback)
Parameters
errorCallbackfunction will be called with error detail, when channel or connection is closed by rabbitmq broker.

◆ setMessageProcessingTimeout()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setMessageProcessingTimeout ( const bsls::TimeInterval &  timeout)

Set time in which consumers should process messages.

Parameters
timeoutMessage processing timeout This timeout specifies the time interval in which a consumer is supposed to process a message. If a consumer takes longer that the specified timeout, warnings will be logged.
Note
the library detects such cases periodically and the warnings generally won't be logged immediately after the given timeout expires. False-positive warnings may still be logged if the library has not processed the consumer acknowledgement before the timeout expires.

◆ setMetricPublisher()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setMetricPublisher ( const bsl::shared_ptr< rmqp::MetricPublisher > &  metricPublisher)
Parameters
metricPublishercustom metric publisher will be used to publish different types of metrics generated by the library.

◆ setProducerTracing()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setProducerTracing ( const bsl::shared_ptr< rmqp::ProducerTracing > &  producerTracing)

will be called back at message send, with meta data to establish a context, the context will be kept alive until the messageConfirm response callback

Parameters
producerTracingimplements the rmqp::ProducerTracing protocol

◆ setShuffleConnectionEndpoints()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setShuffleConnectionEndpoints ( bool  shuffleConnectionEndpoints)

Shuffle endpoints rmq connects to. By default, boost asio (libc) resolves and connects to the node with longest matching subnet prefix causing disproportionately more connections with certain endpoints. Setting this option will shuffle resolver results.

Parameters
shuffleConnectionEndpointsset to true to shuffle.

◆ setThreadpool()

RabbitContextOptions & BloombergLP::rmqa::RabbitContextOptions::setThreadpool ( bdlmt::ThreadPool *  threadpool)
Parameters
threadpoolFor async callbacks (e.g. as messages arrived for Consumer, and as confirmations arrive for Producer). By default a threadpool is created with the following parameters: rmqp::Connection::s_threadPoolMinThreads rmqp::Connection::s_threadPoolMaxThreads rmqp::Connection::s_threadPoolMaxIdleTimeMs A custom threadpool can be provided if it is desirable for async callbacks to be executed in a shared threadpool, or to tune this threadpool. The provided threadpool must live longer than the RabbitContext

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