userver: userver/urabbitmq/typedefs.hpp Source File
Loading...
Searching...
No Matches
typedefs.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/urabbitmq/typedefs.hpp
4/// @brief Convenient typedefs for RabbitMQ entities.
5
6#include <userver/utils/strong_typedef.hpp>
7
8USERVER_NAMESPACE_BEGIN
9
10namespace urabbitmq {
11
12/// @brief StrongTypedef alias for a queue name.
13class Queue final : public utils::StrongTypedef<class QueueTag, std::string> {
14 public:
15 using utils::StrongTypedef<QueueTag, std::string>::StrongTypedef;
16
17 /// @brief Queue options, consult RabbitMQ docs for better understanding
18 enum class Flags {
19 kNone = 0,
20 kPassive = 1 << 0,
21 kDurable = 1 << 1,
22 kExclusive = 1 << 2,
23 kAutoDelete = 1 << 3,
24 kNoAck = 1 << 4
25 };
26};
27
28/// @brief StrongTypedef alias for an exchange name.
29class Exchange final
30 : public utils::StrongTypedef<class ExchangeTag, std::string> {
31 public:
32 using utils::StrongTypedef<ExchangeTag, std::string>::StrongTypedef;
33
34 /// @brief Type of an exchange.
35 ///
36 /// Consult RabbitMQ docs for better understanding.
37 enum class Type {
38 kFanOut,
39 kDirect,
40 kTopic,
41 kHeaders,
42 // plugin required
43 kConsistentHash,
44 // plugin required
45 kMessageDeduplication
46 };
47
48 /// @brief Exchange options, consult RabbitMQ docs for better understanding
49 enum class Flags {
50 kNone = 0,
51 kPassive = 1 << 0,
52 kDurable = 1 << 1,
53 kAutoDelete = 1 << 2,
54 kInternal = 1 << 3,
55 kNoWait = 1 << 4
56 };
57};
58
59/// @brief Message storage type, consult RabbitMQ docs for better understanding
60enum class MessageType {
61 kPersistent,
62 kTransient,
63};
64
65/// @brief Structure holding an AMQP message body along with some of its
66/// metadata fields. This struct is used to pass messages to the end user,
67/// hiding the actual AMQP message object implementation.
69 struct Metadata {
70 std::string exchange;
71 std::string routingKey;
72 };
73 std::string message;
74 Metadata metadata;
75};
76
77} // namespace urabbitmq
78
79USERVER_NAMESPACE_END