#include <userver/urabbitmq/client.hpp>
Interface for communicating with a RabbitMQ cluster.
Usually retrieved from components::RabbitMQ component.
Definition at line 28 of file client.hpp.
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 | |
std::string | Get (const Queue &queue, utils::Flags< Queue::Flags > flags, engine::Deadline deadline) override |
Gets a single message. | |
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< Client > | Create (clients::dns::Resolver &resolver, const ClientSettings &settings) |
Protected Member Functions | |
Client (clients::dns::Resolver &resolver, const ClientSettings &settings) | |
|
overridevirtual |
Bind a queue to an exchange.
exchange | the source exchange |
queue | the target queue |
routing_key | the routing key |
deadline | execution deadline |
Implements urabbitmq::IAdminInterface.
|
static |
Client factory function
resolver | asynchronous DNS resolver |
settings | client settings |
|
inlineoverridevirtual |
overload of DeclareExchange
Implements urabbitmq::IAdminInterface.
Definition at line 51 of file client.hpp.
|
inlineoverridevirtual |
overload of DeclareExchange
Implements urabbitmq::IAdminInterface.
Definition at line 47 of file client.hpp.
|
overridevirtual |
Declare an exchange.
exchange | name of the exchange |
type | exchange type |
flags | exchange flags |
deadline | execution deadline |
Implements urabbitmq::IAdminInterface.
|
inlineoverridevirtual |
overload of DeclareQueue
Implements urabbitmq::IAdminInterface.
Definition at line 57 of file client.hpp.
|
overridevirtual |
Declare a queue.
queue | name of the queue |
flags | queue flags |
deadline | execution deadline |
Implements urabbitmq::IAdminInterface.
|
overridevirtual |
Gets a single message.
You should to set kNoAck
flag in order for server to implicitly acknowledge gathered message. By default the gathered message has to be explicitly acknowledged or rejected, however there's no functionality for that yet, so the flag is basically mandatory. This API is a subject to change.
Consumer
instead.queue | name of the queue |
flags | queue flags |
deadline | execution deadline |
Implements urabbitmq::IChannelInterface.
AdminChannel urabbitmq::Client::GetAdminChannel | ( | engine::Deadline | deadline | ) |
Get an administrative interface for the broker.
deadline | deadline for connection acquisition from the pool |
Channel urabbitmq::Client::GetChannel | ( | engine::Deadline | deadline | ) |
Get a publisher interface for the broker.
deadline | deadline for connection acquisition from the pool |
ReliableChannel urabbitmq::Client::GetReliableChannel | ( | engine::Deadline | deadline | ) |
Get a reliable publisher interface for the broker (publisher-confirms)
deadline | deadline for connection acquisition from the pool |
|
inlineoverridevirtual |
overload of Publish
Implements urabbitmq::IChannelInterface.
Definition at line 83 of file client.hpp.
|
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
exchange | the exchange to publish to |
routing_key | the routing key |
message | the message to send |
deadline | execution deadline |
fire and forget
(no delivery guarantees), use PublishReliable
for delivery guarantees. Implements urabbitmq::IChannelInterface.
|
inlineoverridevirtual |
overload of PublishReliable
Implements urabbitmq::IReliableChannelInterface.
Definition at line 107 of file client.hpp.
|
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
exchange | the exchange to publish to |
routing_key | the routing key |
message | the message to send |
deadline | execution deadline |
Implements urabbitmq::IReliableChannelInterface.
|
overridevirtual |
Remove an exchange.
exchange | name of the exchange to remove |
deadline | execution deadline |
Implements urabbitmq::IAdminInterface.
|
overridevirtual |
Remove a queue.
queue | name of the queue to remove |
deadline | execution deadline |
Implements urabbitmq::IAdminInterface.
|
friend |
Definition at line 129 of file client.hpp.