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

A RabbitMQ VHost object. More...

#include <rmqa_vhost.h>

Public Member Functions

 VHost (bslma::ManagedPtr< rmqp::Connection > impl)
 
virtual ~VHost ()
 The RabbitMQ connection will be disconnected on this call.
 
rmqt::Result< ProducercreateProducer (const rmqp::Topology &topology, rmqt::ExchangeHandle exchange, uint16_t maxOutstandingConfirms)
 Create a producer using the provided Topology. This method starts the process of declaring the topology, and creating the producer. The returned Future provides access to the Producer when it is ready. More...
 
rmqt::Result< ConsumercreateConsumer (const rmqp::Topology &topology, rmqt::QueueHandle queue, const rmqp::Consumer::ConsumerFunc &onMessage, const rmqt::ConsumerConfig &config=rmqt::ConsumerConfig())
 Create an asynchronous consumer using the provided Topology. More...
 
rmqt::Result< ConsumercreateConsumer (const rmqp::Topology &topology, rmqt::QueueHandle queue, const rmqp::Consumer::ConsumerFunc &onMessage, const bsl::string &consumerTag, uint16_t prefetchCount=rmqt::ConsumerConfig::s_defaultPrefetchCount)
 Create an asynchronous consumer using the provided Topology. More...
 
void close ()
 Close the connection to the broker. The connection will not reconnect after this call.
 

Static Public Member Functions

static bsl::string generateConsumerTag ()
 

Detailed Description

A RabbitMQ VHost object.

Represents connections needed to communicate with a vhost on the RabbitMQ broker. Useful to create Producer and Consumer channels/objects. The VHost must live longer than Consumers and Producers created from it.

Constructor & Destructor Documentation

◆ VHost()

BloombergLP::rmqa::VHost::VHost ( bslma::ManagedPtr< rmqp::Connection impl)
explicit

VHost (connections) are constructed by RabbitContext::createVhostConnection

Member Function Documentation

◆ createConsumer() [1/2]

rmqt::Result< rmqa::Consumer > BloombergLP::rmqa::VHost::createConsumer ( const rmqp::Topology topology,
rmqt::QueueHandle  queue,
const rmqp::Consumer::ConsumerFunc onMessage,
const bsl::string &  consumerTag,
uint16_t  prefetchCount = rmqt::ConsumerConfig::s_defaultPrefetchCount 
)

Create an asynchronous consumer using the provided Topology.

Deprecated:
Parameters
topologyThe RabbitMQ topology which will be declared on the broker with this consumer.
queueThe queue to consume from. This queue must be contained within topology.
consumerTagA label for the consumer which is displayed on the RabbitMQ Management UI. It is useful to give this a meaningful name.
onMessageThe callback to be invoked on each message. This will be invoked from the RabbitContext threadpool.
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.
Returns
A result which will contain either the connected consumer object which has been registered on the Event Loop thread or an error.
Note
The VHost object must outlive the Consumer

◆ createConsumer() [2/2]

rmqt::Result< Consumer > BloombergLP::rmqa::VHost::createConsumer ( const rmqp::Topology topology,
rmqt::QueueHandle  queue,
const rmqp::Consumer::ConsumerFunc onMessage,
const rmqt::ConsumerConfig config = rmqt::ConsumerConfig() 
)

Create an asynchronous consumer using the provided Topology.

Parameters
topologyThe RabbitMQ topology which will be declared on the broker with this consumer.
queueThe queue to consume from. This queue must be contained within topology.
onMessageThe callback to be invoked on each message. This will be invoked from the RabbitContext threadpool.
configadditional options like the prefetchCount and the consumerTag
Returns
A result which will contain either the connected consumer object which has been registered on the Event Loop thread or an error.
Note
The VHost object must outlive the Consumer

◆ createProducer()

rmqt::Result< Producer > BloombergLP::rmqa::VHost::createProducer ( const rmqp::Topology topology,
rmqt::ExchangeHandle  exchange,
uint16_t  maxOutstandingConfirms 
)

Create a producer using the provided Topology. This method starts the process of declaring the topology, and creating the producer. The returned Future provides access to the Producer when it is ready.

Parameters
topologyThe RabbitMQ topology declared by this producer. This topology will be automatically re-declared on reconnection.
exchangeThe exchange all messages will be published to. This exchange must be contained in topology for the Producer to be successfully created.
maxOutstandingConfirmsThe maximum number of unconfirmed messages Producer will allow before blocking and waiting for a publisher confirm from the broker.
Returns
A result which will either be a connected producer that has been registered on the Event Loop thread or an error.
Note
The VHost object must outlive the Producer

◆ generateConsumerTag()

bsl::string BloombergLP::rmqa::VHost::generateConsumerTag ( )
static

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