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

Owns resources shared between multiple RabbitMQ connections. More...

#include <rmqa_rabbitcontext.h>

Public Member Functions

 RabbitContext (const RabbitContextOptions &options=RabbitContextOptions())
 Construct a RabbitContext. More...
 
 RabbitContext (bslma::ManagedPtr< rmqp::RabbitContext > impl)
 Construct a RabbitContext with a different implementation This is primarily used by mock objects for unit tests. More...
 
 ~RabbitContext ()
 
bsl::shared_ptr< VHostcreateVHostConnection (const bsl::string &userDefinedName, const bsl::shared_ptr< rmqt::Endpoint > &endpoint, const bsl::shared_ptr< rmqt::Credentials > &credentials)
 Connect to a RabbitMQ broker. More...
 
bsl::shared_ptr< VHostcreateVHostConnection (const bsl::string &userDefinedName, const rmqt::VHostInfo &vhostInfo)
 Connect to a RabbitMQ broker. More...
 

Detailed Description

Owns resources shared between multiple RabbitMQ connections.

rmqa::RabbitContext Owns the threadpool & async event loop which is shared between connections. rmqa::RabbitContext must live longer than all connections created from it.

Constructor & Destructor Documentation

◆ RabbitContext() [1/2]

BloombergLP::rmqa::RabbitContext::RabbitContext ( const RabbitContextOptions options = RabbitContextOptions())
explicit

Construct a RabbitContext.

Parameters
optionsRabbitContextOptions object with user-specified arguments

◆ RabbitContext() [2/2]

BloombergLP::rmqa::RabbitContext::RabbitContext ( bslma::ManagedPtr< rmqp::RabbitContext impl)
explicit

Construct a RabbitContext with a different implementation This is primarily used by mock objects for unit tests.

Parameters
implimplements all methods RabbitContext provides

◆ ~RabbitContext()

BloombergLP::rmqa::RabbitContext::~RabbitContext ( )

Trigger the destruction of the event loop, and (if not passed in) the threadpool. The destructor will block waiting for the eventloop and threadpool threads to join(). rmqa::VHost handles should be destructed before the RabbitContext to avoid waiting indefinitely.

Member Function Documentation

◆ createVHostConnection() [1/2]

bsl::shared_ptr< rmqa::VHost > BloombergLP::rmqa::RabbitContext::createVHostConnection ( const bsl::string &  userDefinedName,
const bsl::shared_ptr< rmqt::Endpoint > &  endpoint,
const bsl::shared_ptr< rmqt::Credentials > &  credentials 
)

Connect to a RabbitMQ broker.

Parameters
endpointidentifies the broker to connect to
credentialsAuthentication information

Create a new rmqa::VHost to a RabbitMQ broker. Connections will be established (with the broker) when creating producers or consumers on the vhost object

◆ createVHostConnection() [2/2]

bsl::shared_ptr< rmqa::VHost > BloombergLP::rmqa::RabbitContext::createVHostConnection ( const bsl::string &  userDefinedName,
const rmqt::VHostInfo vhostInfo 
)

Connect to a RabbitMQ broker.

Parameters
vhostInfoidentifies the broker to connect to & authentication details

Create a new rmqa::VHost to a RabbitMQ broker. Connections will be established (with the broker) when creating producers or consumers on the vhost object


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