userver: urabbitmq::Client Class Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts

Interface for communicating with a RabbitMQ cluster. More...

#include <userver/urabbitmq/client.hpp>

+ Inheritance diagram for urabbitmq::Client:
+ Collaboration diagram for urabbitmq::Client:

Public Member Functions

 ~Client ()
 Client destructor.
 
void DeclareExchange (const Exchange &exchange, Exchange::Type type, utils::Flags< Exchange::Flags > flags, engine::Deadline deadline) override
 Declare an exchange.
 
void DeclareExchange (const Exchange &exchange, Exchange::Type type, engine::Deadline deadline) override
 overload of DeclareExchange
 
void DeclareExchange (const Exchange &exchange, engine::Deadline deadline) override
 overload of DeclareExchange
 
void DeclareQueue (const Queue &queue, utils::Flags< Queue::Flags > flags, engine::Deadline deadline) override
 Declare a queue.
 
void DeclareQueue (const Queue &queue, engine::Deadline deadline) override
 overload of DeclareQueue
 
void BindQueue (const Exchange &exchange, const Queue &queue, const std::string &routing_key, engine::Deadline deadline) override
 Bind a queue to an exchange.
 
void RemoveExchange (const Exchange &exchange, engine::Deadline deadline) override
 Remove an exchange.
 
void RemoveQueue (const Queue &queue, engine::Deadline deadline) override
 Remove a queue.
 
AdminChannel GetAdminChannel (engine::Deadline deadline)
 Get an administrative interface for the broker.
 
void Publish (const Exchange &exchange, const std::string &routing_key, const std::string &message, MessageType type, engine::Deadline deadline) override
 Publish a message to an exchange.
 
void Publish (const Exchange &exchange, const std::string &routing_key, const std::string &message, engine::Deadline deadline) override
 overload of Publish
 
Channel GetChannel (engine::Deadline deadline)
 Get a publisher interface for the broker.
 
void PublishReliable (const Exchange &exchange, const std::string &routing_key, const std::string &message, MessageType type, engine::Deadline deadline) override
 Publish a message to an exchange and await confirmation from the broker.
 
void PublishReliable (const Exchange &exchange, const std::string &routing_key, const std::string &message, engine::Deadline deadline) override
 overload of PublishReliable
 
ReliableChannel GetReliableChannel (engine::Deadline deadline)
 Get a reliable publisher interface for the broker (publisher-confirms)
 
void WriteStatistics (utils::statistics::Writer &writer) const
 Write cluster statistics.
 

Static Public Member Functions

static std::shared_ptr< ClientCreate (clients::dns::Resolver &resolver, const ClientSettings &settings)
 

Protected Member Functions

 Client (clients::dns::Resolver &resolver, const ClientSettings &settings)
 

Friends

class ConsumerBase
 

Detailed Description

Interface for communicating with a RabbitMQ cluster.

Usually retrieved from components::RabbitMQ component.

Definition at line 28 of file client.hpp.

Member Function Documentation

◆ BindQueue()

void urabbitmq::Client::BindQueue ( const Exchange exchange,
const Queue queue,
const std::string &  routing_key,
engine::Deadline  deadline 
)
overridevirtual

Bind a queue to an exchange.

Parameters
exchangethe source exchange
queuethe target queue
routing_keythe routing key
deadlineexecution deadline

Implements urabbitmq::IAdminInterface.

◆ Create()

static std::shared_ptr< Client > urabbitmq::Client::Create ( clients::dns::Resolver resolver,
const ClientSettings settings 
)
static

Client factory function

Parameters
resolverasynchronous DNS resolver
settingsclient settings

◆ DeclareExchange() [1/3]

void urabbitmq::Client::DeclareExchange ( const Exchange exchange,
engine::Deadline  deadline 
)
inlineoverridevirtual

overload of DeclareExchange

Implements urabbitmq::IAdminInterface.

Definition at line 50 of file client.hpp.

◆ DeclareExchange() [2/3]

void urabbitmq::Client::DeclareExchange ( const Exchange exchange,
Exchange::Type  type,
engine::Deadline  deadline 
)
inlineoverridevirtual

overload of DeclareExchange

Implements urabbitmq::IAdminInterface.

Definition at line 45 of file client.hpp.

◆ DeclareExchange() [3/3]

void urabbitmq::Client::DeclareExchange ( const Exchange exchange,
Exchange::Type  type,
utils::Flags< Exchange::Flags flags,
engine::Deadline  deadline 
)
overridevirtual

Declare an exchange.

Parameters
exchangename of the exchange
typeexchange type
flagsexchange flags
deadlineexecution deadline

Implements urabbitmq::IAdminInterface.

◆ DeclareQueue() [1/2]

void urabbitmq::Client::DeclareQueue ( const Queue queue,
engine::Deadline  deadline 
)
inlineoverridevirtual

overload of DeclareQueue

Implements urabbitmq::IAdminInterface.

Definition at line 58 of file client.hpp.

◆ DeclareQueue() [2/2]

void urabbitmq::Client::DeclareQueue ( const Queue queue,
utils::Flags< Queue::Flags flags,
engine::Deadline  deadline 
)
overridevirtual

Declare a queue.

Parameters
queuename of the queue
flagsqueue flags
deadlineexecution deadline

Implements urabbitmq::IAdminInterface.

◆ GetAdminChannel()

AdminChannel urabbitmq::Client::GetAdminChannel ( engine::Deadline  deadline)

Get an administrative interface for the broker.

Parameters
deadlinedeadline for connection acquisition from the pool

◆ GetChannel()

Channel urabbitmq::Client::GetChannel ( engine::Deadline  deadline)

Get a publisher interface for the broker.

Parameters
deadlinedeadline for connection acquisition from the pool

◆ GetReliableChannel()

ReliableChannel urabbitmq::Client::GetReliableChannel ( engine::Deadline  deadline)

Get a reliable publisher interface for the broker (publisher-confirms)

Parameters
deadlinedeadline for connection acquisition from the pool

◆ Publish() [1/2]

void urabbitmq::Client::Publish ( const Exchange exchange,
const std::string &  routing_key,
const std::string &  message,
engine::Deadline  deadline 
)
inlineoverridevirtual

overload of Publish

Implements urabbitmq::IChannelInterface.

Definition at line 80 of file client.hpp.

◆ Publish() [2/2]

void urabbitmq::Client::Publish ( const Exchange exchange,
const std::string &  routing_key,
const std::string &  message,
MessageType  type,
engine::Deadline  deadline 
)
overridevirtual

Publish a message to an exchange.

You have to supply the name of the exchange and a routing key. RabbitMQ will then try to send the message to one or more queues. By default unroutable messages are silently discarded

Parameters
exchangethe exchange to publish to
routing_keythe routing key
messagethe message to send
deadlineexecution deadline
Note
This method is fire and forget (no delivery guarantees), use PublishReliable for delivery guarantees.

Implements urabbitmq::IChannelInterface.

◆ PublishReliable() [1/2]

void urabbitmq::Client::PublishReliable ( const Exchange exchange,
const std::string &  routing_key,
const std::string &  message,
engine::Deadline  deadline 
)
inlineoverridevirtual

overload of PublishReliable

Implements urabbitmq::IReliableChannelInterface.

Definition at line 94 of file client.hpp.

◆ PublishReliable() [2/2]

void urabbitmq::Client::PublishReliable ( const Exchange exchange,
const std::string &  routing_key,
const std::string &  message,
MessageType  type,
engine::Deadline  deadline 
)
overridevirtual

Publish a message to an exchange and await confirmation from the broker.

You have to supply the name of the exchange and a routing key. RabbitMQ will then try to send the message to one or more queues. By default unroutable messages are silently discarded

Parameters
exchangethe exchange to publish to
routing_keythe routing key
messagethe message to send
deadlineexecution deadline

Implements urabbitmq::IReliableChannelInterface.

◆ RemoveExchange()

void urabbitmq::Client::RemoveExchange ( const Exchange exchange,
engine::Deadline  deadline 
)
overridevirtual

Remove an exchange.

Parameters
exchangename of the exchange to remove
deadlineexecution deadline

Implements urabbitmq::IAdminInterface.

◆ RemoveQueue()

void urabbitmq::Client::RemoveQueue ( const Queue queue,
engine::Deadline  deadline 
)
overridevirtual

Remove a queue.

Parameters
queuename of the queue to remove
deadlineexecution deadline

Implements urabbitmq::IAdminInterface.

Friends And Related Symbol Documentation

◆ ConsumerBase

friend class ConsumerBase
friend

Definition at line 114 of file client.hpp.


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