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

This class provides a manipulatable RabbitMQ topology structure. More...

#include <rmqa_topology.h>

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

Public Member Functions

rmqt::QueueHandle addQueue (const bsl::string &name=bsl::string(), rmqt::AutoDelete::Value=rmqt::AutoDelete::OFF, rmqt::Durable::Value=rmqt::Durable::ON, const rmqt::FieldTable &args=rmqt::FieldTable()) BSLS_KEYWORD_OVERRIDE
 Declare a queue. More...
 
rmqt::ExchangeHandle addExchange (const bsl::string &name, const rmqt::ExchangeType &exchangeType=rmqt::ExchangeType::DIRECT, rmqt::AutoDelete::Value=rmqt::AutoDelete::OFF, rmqt::Durable::Value=rmqt::Durable::ON, rmqt::Internal::Value=rmqt::Internal::NO, const rmqt::FieldTable &args=rmqt::FieldTable()) BSLS_KEYWORD_OVERRIDE
 Declare an exchange. More...
 
rmqt::ExchangeHandle addPassiveExchange (const bsl::string &name) BSLS_KEYWORD_OVERRIDE
 Declare a dependency on an existing Exchange. If the exchange isn't already declared on the server, it will return an error and the library will fail to connect. More...
 
rmqt::QueueHandle addPassiveQueue (const bsl::string &name) BSLS_KEYWORD_OVERRIDE
 Declare a dependency on an existing Queue. If the queue isn't already declared on the server, it will return an error and the library will fail to connect. More...
 
void bind (const rmqt::ExchangeHandle &exchangeName, const rmqt::QueueHandle &queue, const bsl::string &bindingKey, const rmqt::FieldTable &args=rmqt::FieldTable()) BSLS_KEYWORD_OVERRIDE
 Bind a queue and an exchange. More...
 
void bind (const rmqt::ExchangeHandle &sourceExchange, const rmqt::ExchangeHandle &destinationExchange, const bsl::string &bindingKey, const rmqt::FieldTable &args=rmqt::FieldTable()) BSLS_KEYWORD_OVERRIDE
 Bind two exchanges. More...
 
const rmqt::Topologytopology () const BSLS_KEYWORD_OVERRIDE
 Get a readonly copy of stored topology. More...
 
const rmqt::ExchangeHandle defaultExchange () BSLS_KEYWORD_OVERRIDE
 Retrieve a handle for the default exchange. More...
 

Friends

bsl::ostream & operator<< (bsl::ostream &os, const Topology &topology)
 

Detailed Description

This class provides a manipulatable RabbitMQ topology structure.

Represents the RabbitMQ topology, allowing declaring of Exchanges, Queues, and Bindings. This object is passed to rmqa::VHost when creating Producers and Consumers, which ensure this topology is available on the broker.

Constructor & Destructor Documentation

◆ ~Topology()

BloombergLP::rmqa::Topology::~Topology ( )
virtual

Reimplemented from BloombergLP::rmqp::Topology.

Member Function Documentation

◆ addExchange()

rmqt::ExchangeHandle BloombergLP::rmqa::Topology::addExchange ( const bsl::string &  name,
const rmqt::ExchangeType exchangeType = rmqt::ExchangeType::DIRECT,
rmqt::AutoDelete::Value  autoDelete = rmqt::AutoDelete::OFF,
rmqt::Durable::Value  durable = rmqt::Durable::ON,
rmqt::Internal::Value  internal = rmqt::Internal::NO,
const rmqt::FieldTable args = rmqt::FieldTable() 
)
virtual

Declare an exchange.

Parameters
nameExchange name. Maximum allowed length is 127 characters. See https://www.rabbitmq.com/amqp-0-9-1-reference.html#exchange.declare.exchange for name rules.
exchangeTypeThe exchange type drives the meaning of the routingKey when publishing to an exchange.
autoDeleteWhen ON the exchange is deleted after all bindings are removed.
durableWhen ON the exchange declaration will survive broker restarts
internalWhen YES the exchange is declared as an internal. Internal exchange cannot be used directly by publishers. It can be used, when bound to other exchange.
argsFurther Exchange properties are controlled by key-value properties defined in an rmqt::FieldTable.
Returns
ExchangeHandle which can later be used in producers/consumers. The result type has pointer semantics and does not pass the ownership to the caller.

Implements BloombergLP::rmqp::Topology.

◆ addPassiveExchange()

rmqt::ExchangeHandle BloombergLP::rmqa::Topology::addPassiveExchange ( const bsl::string &  name)
virtual

Declare a dependency on an existing Exchange. If the exchange isn't already declared on the server, it will return an error and the library will fail to connect.

Parameters
nameExchange name.
Returns
ExchangeHandle which can later be used in producers/consumers. The result type has pointer semantics and does not pass the ownership to the caller.

Implements BloombergLP::rmqp::Topology.

◆ addPassiveQueue()

rmqt::QueueHandle BloombergLP::rmqa::Topology::addPassiveQueue ( const bsl::string &  name)
virtual

Declare a dependency on an existing Queue. If the queue isn't already declared on the server, it will return an error and the library will fail to connect.

Parameters
nameQueue name.
Returns
QueueHandle which can later be used in producers/consumers. The result type has pointer semantics and does not pass the ownership to the caller.

Implements BloombergLP::rmqp::Topology.

◆ addQueue()

rmqt::QueueHandle BloombergLP::rmqa::Topology::addQueue ( const bsl::string &  name = bsl::string(),
rmqt::AutoDelete::Value  autoDelete = rmqt::AutoDelete::OFF,
rmqt::Durable::Value  durable = rmqt::Durable::ON,
const rmqt::FieldTable args = rmqt::FieldTable() 
)
virtual

Declare a queue.

Parameters
nameQueue Name. See https://www.rabbitmq.com/queues.html#names for name rules.
autoDeleteNot recommended When ON the queue is declared as autodelete. An autodelete queue is deleted when it's last consumer is cancelled. This could cause data loss if all consumers are disconnected in an outage.
durableWhen ON the queue declaration will survive broker restarts. Persistent messages will also survive broker restart in the queue. Message persistence is controlled by the publisher.
argsOther queue properties (such as TTL) are controlled by key-value properties held in a rmqt::FieldTable.
Returns
QueueHandle which can be later used in producers/consumers. The result type has pointer semantics and does not pass the ownership to the caller.

Implements BloombergLP::rmqp::Topology.

◆ bind() [1/2]

void BloombergLP::rmqa::Topology::bind ( const rmqt::ExchangeHandle &  exchangeName,
const rmqt::QueueHandle &  queue,
const bsl::string &  bindingKey,
const rmqt::FieldTable args = rmqt::FieldTable() 
)
virtual

Bind a queue and an exchange.

Implements BloombergLP::rmqp::Topology.

◆ bind() [2/2]

void BloombergLP::rmqa::Topology::bind ( const rmqt::ExchangeHandle &  sourceExchange,
const rmqt::ExchangeHandle &  destinationExchange,
const bsl::string &  bindingKey,
const rmqt::FieldTable args = rmqt::FieldTable() 
)
virtual

Bind two exchanges.

Implements BloombergLP::rmqp::Topology.

◆ defaultExchange()

const rmqt::ExchangeHandle BloombergLP::rmqa::Topology::defaultExchange ( )
virtual

Retrieve a handle for the default exchange.

The default exchange is an exchange named '' (length 0). It is a DIRECT exchange with automatic bindings for all queues within the vhost

Implements BloombergLP::rmqp::Topology.

◆ topology()

const rmqt::Topology & BloombergLP::rmqa::Topology::topology ( ) const
virtual

Get a readonly copy of stored topology.

This is used internally by rmqamqp to send the topology to the broker

Implements BloombergLP::rmqp::Topology.


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