userver: userver/urabbitmq/admin_channel.hpp Source File
Loading...
Searching...
No Matches
admin_channel.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/urabbitmq/admin_channel.hpp
4/// @brief Administrative interface for the broker.
5
6#include <memory>
7
8#include <userver/utils/fast_pimpl.hpp>
9
10#include <userver/urabbitmq/broker_interface.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14namespace urabbitmq {
15
16class ConnectionPtr;
17
18/// @brief Administrative interface for the broker.
19/// You may use this class to setup your exchanges/queues/bindings.
20/// You may as well use `Client` itself instead.
21///
22/// You are not expected to store this class for a long time, because it takes
23/// a connection from the underlying connections pool.
24///
25/// Usually retrieved from `Client`
26class AdminChannel final : IAdminInterface {
27public:
28 AdminChannel(ConnectionPtr&& channel);
29 ~AdminChannel();
30
31 AdminChannel(AdminChannel&& other) noexcept;
32
34 const Exchange& exchange,
35 Exchange::Type type,
36 utils::Flags<Exchange::Flags> flags,
37 engine::Deadline deadline
38 ) override;
39
40 void DeclareExchange(const Exchange& exchange, Exchange::Type type, engine::Deadline deadline) override {
41 DeclareExchange(exchange, type, {}, deadline);
42 }
43
44 void DeclareExchange(const Exchange& exchange, engine::Deadline deadline) override {
45 DeclareExchange(exchange, Exchange::Type::kFanOut, {}, deadline);
46 }
47
48 void DeclareQueue(const Queue& queue, utils::Flags<Queue::Flags> flags, engine::Deadline deadline) override;
49
50 void DeclareQueue(const Queue& queue, engine::Deadline deadline) override { DeclareQueue(queue, {}, deadline); }
51
53 const Exchange& exchange,
54 const Queue& queue,
55 const std::string& routing_key,
56 engine::Deadline deadline
57 ) override;
58
59 void RemoveExchange(const Exchange& exchange, engine::Deadline deadline) override;
60
61 void RemoveQueue(const Queue& queue, engine::Deadline deadline) override;
62
63private:
64 utils::FastPimpl<ConnectionPtr, 32, 8> impl_;
65};
66
67} // namespace urabbitmq
68
69USERVER_NAMESPACE_END