Github   Telegram
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
urabbitmq::Client Class Reference

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. More...
 
void DeclareExchange (const Exchange &exchange, Exchange::Type type, engine::Deadline deadline) override
 overload of DeclareExchange More...
 
void DeclareExchange (const Exchange &exchange, engine::Deadline deadline) override
 overload of DeclareExchange More...
 
void DeclareQueue (const Queue &queue, utils::Flags< Queue::Flags > flags, engine::Deadline deadline) override
 Declare a queue. More...
 
void DeclareQueue (const Queue &queue, engine::Deadline deadline) override
 overload of DeclareQueue More...
 
void BindQueue (const Exchange &exchange, const Queue &queue, const std::string &routing_key, engine::Deadline deadline) override
 Bind a queue to an exchange. More...
 
void RemoveExchange (const Exchange &exchange, engine::Deadline deadline) override
 Remove an exchange. More...
 
void RemoveQueue (const Queue &queue, engine::Deadline deadline) override
 Remove a queue. More...
 
AdminChannel GetAdminChannel (engine::Deadline deadline)
 Get an administrative interface for the broker. More...
 
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. More...
 
void Publish (const Exchange &exchange, const std::string &routing_key, const std::string &message, engine::Deadline deadline) override
 overload of Publish More...
 
Channel GetChannel (engine::Deadline deadline)
 Get a publisher interface for the broker. More...
 
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. More...
 
void PublishReliable (const Exchange &exchange, const std::string &routing_key, const std::string &message, engine::Deadline deadline) override
 overload of PublishReliable More...
 
ReliableChannel GetReliableChannel (engine::Deadline deadline)
 Get a reliable publisher interface for the broker (publisher-confirms) More...
 
formats::json::Value GetStatistics () const
 Get cluster statistics.
 
virtual void DeclareExchange (const Exchange &exchange, Exchange::Type type, utils::Flags< Exchange::Flags > flags, engine::Deadline deadline)=0
 Declare an exchange. More...
 
virtual void DeclareExchange (const Exchange &exchange, Exchange::Type type, engine::Deadline deadline)=0
 overload of DeclareExchange More...
 
virtual void DeclareExchange (const Exchange &exchange, engine::Deadline deadline)=0
 overload of DeclareExchange More...
 
virtual void DeclareQueue (const Queue &queue, utils::Flags< Queue::Flags > flags, engine::Deadline deadline)=0
 Declare a queue. More...
 
virtual void DeclareQueue (const Queue &queue, engine::Deadline deadline)=0
 overload of DeclareQueue More...
 
virtual void BindQueue (const Exchange &exchange, const Queue &queue, const std::string &routing_key, engine::Deadline deadline)=0
 Bind a queue to an exchange. More...
 
virtual void RemoveExchange (const Exchange &exchange, engine::Deadline deadline)=0
 Remove an exchange. More...
 
virtual void RemoveQueue (const Queue &queue, engine::Deadline deadline)=0
 Remove a queue. More...
 
virtual void Publish (const Exchange &exchange, const std::string &routing_key, const std::string &message, MessageType type, engine::Deadline deadline)=0
 Publish a message to an exchange. More...
 
virtual void Publish (const Exchange &exchange, const std::string &routing_key, const std::string &message, engine::Deadline deadline)=0
 overload of Publish More...
 
virtual void PublishReliable (const Exchange &exchange, const std::string &routing_key, const std::string &message, MessageType type, engine::Deadline deadline)=0
 Publish a message to an exchange and await confirmation from the broker. More...
 
virtual void PublishReliable (const Exchange &exchange, const std::string &routing_key, const std::string &message, engine::Deadline deadline)=0
 overload of PublishReliable More...
 

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 Function 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: