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

A RabbitMQ VHost Implementation of the rmqp::Connection interface. More...

#include <rmqa_vhostimpl.h>

Inheritance diagram for BloombergLP::rmqa::VHostImpl:
Inheritance graph
[legend]
Collaboration diagram for BloombergLP::rmqa::VHostImpl:
Collaboration graph
[legend]

Public Types

typedef bsl::function< rmqt::Future< rmqp::Connection >(const bsl::string &suffix)> ConnectionMaker
 
enum  ReturnCode { SUCCESS = 0 , FAIL }
 

Public Member Functions

 VHostImpl (const ConnectionMaker &connectionMaker)
 
rmqt::Result< rmqp::ProducercreateProducer (const rmqt::Topology &topology, rmqt::ExchangeHandle exchange, uint16_t maxOutstandingConfirms) BSLS_KEYWORD_OVERRIDE
 
rmqt::Result< rmqp::ConsumercreateConsumer (const rmqt::Topology &topology, rmqt::QueueHandle queue, const rmqp::Consumer::ConsumerFunc &onMessage, const rmqt::ConsumerConfig &config) BSLS_KEYWORD_OVERRIDE
 Create an asynchronous consumer using the provided Topology. More...
 
rmqt::Future< rmqp::ProducercreateProducerAsync (const rmqt::Topology &topology, rmqt::ExchangeHandle exchange, uint16_t maxOutstandingConfirms) BSLS_KEYWORD_OVERRIDE
 
rmqt::Future< rmqp::ConsumercreateConsumerAsync (const rmqt::Topology &topology, rmqt::QueueHandle queue, const rmqp::Consumer::ConsumerFunc &onMessage, const rmqt::ConsumerConfig &config) BSLS_KEYWORD_OVERRIDE
 
void close () BSLS_KEYWORD_OVERRIDE
 Flush all data pending and then close the connection. Close the connection and invalidates all consumers and producers created through this connection. More...
 
virtual rmqt::Result< rmqp::ConsumercreateConsumer (const rmqt::Topology &topology, rmqt::QueueHandle queue, const rmqp::Consumer::ConsumerFunc &messageConsumer, const bsl::string &consumerTag, uint16_t prefetchCount)
 
virtual rmqt::Future< rmqp::ConsumercreateConsumerAsync (const rmqt::Topology &topology, rmqt::QueueHandle queue, const rmqp::Consumer::ConsumerFunc &messageConsumer, const bsl::string &consumerTag, uint16_t prefetchCount)
 

Detailed Description

A RabbitMQ VHost Implementation of the rmqp::Connection interface.

Member Function Documentation

◆ close()

void BloombergLP::rmqa::VHostImpl::close ( )
virtual

Flush all data pending and then close the connection. Close the connection and invalidates all consumers and producers created through this connection.

Implements BloombergLP::rmqp::Connection.

◆ createConsumer() [1/2]

rmqt::Result< rmqp::Consumer > BloombergLP::rmqp::Connection::createConsumer ( const rmqt::Topology topology,
rmqt::QueueHandle  queue,
const rmqp::Consumer::ConsumerFunc messageConsumer,
const bsl::string &  consumerTag,
uint16_t  prefetchCount 
)
virtualinherited

Create an asynchronous consumer using the topology provided. This method also creates the topology on the target broker synchronously using the timeout provided. If the timeout expires, the converted bool value of Result object returned by this function will be false. The value of the result Result::value() will be still usable in this case though. User-defined callbacks are run on the thread-pool, as messages are received from the broker.

◆ createConsumer() [2/2]

rmqt::Result< rmqp::Consumer > BloombergLP::rmqa::VHostImpl::createConsumer ( const rmqt::Topology topology,
rmqt::QueueHandle  queue,
const rmqp::Consumer::ConsumerFunc onMessage,
const rmqt::ConsumerConfig consumerConfig 
)
virtual

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.
consumerConfigdictates any optional tunables for the consumer, e.g. consumerTag, prefetchCount, threadpool to process the messages on
Returns
A result which will contain either the connected consumer object which has been registered on the Event Loop thread or an error.

Implements BloombergLP::rmqp::Connection.

◆ createConsumerAsync()

rmqt::Future< rmqp::Consumer > BloombergLP::rmqa::VHostImpl::createConsumerAsync ( const rmqt::Topology topology,
rmqt::QueueHandle  queue,
const rmqp::Consumer::ConsumerFunc onMessage,
const rmqt::ConsumerConfig config 
)
virtual

◆ createProducer()

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

Create a producer for the given exchange using the topology provided. 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 topology declared by this producer. This topology will be re-declared on reconnection. The passed exchange must exist in the given topology
exchangeThe exchange to which all produced messages will be published
maxOutstandingConfirmsThe maximum number of confirms the Producer will allow before blocking, and waiting for a confirm from the broker

Implements BloombergLP::rmqp::Connection.

◆ createProducerAsync()

rmqt::Future< rmqp::Producer > BloombergLP::rmqa::VHostImpl::createProducerAsync ( const rmqt::Topology topology,
rmqt::ExchangeHandle  exchange,
uint16_t  maxOutstandingConfirms 
)
virtual

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