RMQ - RabbitMQ C++ Library
rmqt_properties.h
1// Copyright 2020-2023 Bloomberg Finance L.P.
2// SPDX-License-Identifier: Apache-2.0
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#ifndef INCLUDED_RMQT_PROPERTIES
17#define INCLUDED_RMQT_PROPERTIES
18
19#include <rmqt_fieldvalue.h>
20
21#include <bdlb_nullablevalue.h>
22#include <bdlt_datetime.h>
23
24#include <bsl_memory.h>
25#include <bsl_ostream.h>
26#include <bsl_set.h>
27#include <bsl_string.h>
28
29namespace BloombergLP {
30namespace rmqt {
31
32//@PURPOSE: Provide values of different properties for queues or exchanges like
33// durable, auto-delete etc.
34
35namespace Durable {
36typedef enum { OFF = 0, ON = 1 } Value;
37}
38
39namespace AutoDelete {
40typedef enum { OFF = 0, ON = 1 } Value;
41}
42
43namespace Internal {
44typedef enum { NO = 0, YES = 1 } Value;
45}
46
47namespace DeliveryMode {
48typedef enum { NON_PERSISTENT = 1, PERSISTENT = 2 } Value;
49}
50
51namespace Exclusive {
52typedef enum { OFF = 0, ON = 1 } Value;
53}
54
55typedef bsl::set<bsl::string> Tunables;
56
57namespace QueueUnused {
58typedef enum { ALLOW_IN_USE = 0, IF_UNUSED = 1 } Value;
59}
60
61namespace QueueEmpty {
62typedef enum { ALLOW_MSG_DELETE = 0, IF_EMPTY = 1 } Value;
63}
64
65namespace Mandatory {
66typedef enum { DISCARD_UNROUTABLE = 0, RETURN_UNROUTABLE = 1 } Value;
67}
68
73struct Properties {
75 bdlb::NullableValue<bsl::string> contentType;
76
78 bdlb::NullableValue<bsl::string> contentEncoding;
79
81 bsl::shared_ptr<rmqt::FieldTable> headers;
82
84 bdlb::NullableValue<bsl::uint8_t> deliveryMode;
85
87 bdlb::NullableValue<bsl::uint8_t> priority;
88
90 bdlb::NullableValue<bsl::string> correlationId;
91
98 bdlb::NullableValue<bsl::string> replyTo;
99
101 bdlb::NullableValue<bsl::string> expiration;
102
104 bdlb::NullableValue<bsl::string> messageId;
105
107 bdlb::NullableValue<bdlt::Datetime> timestamp;
108
110 bdlb::NullableValue<bsl::string> type;
111
113 bdlb::NullableValue<bsl::string> userId;
114
116 bdlb::NullableValue<bsl::string> appId;
117
118 bsl::ostream&
119 print(bsl::ostream& stream, int level, int spacesPerLevel) const;
120};
121
122bool operator==(const Properties& lhs, const Properties& rhs);
123bool operator!=(const Properties& lhs, const Properties& rhs);
124bsl::ostream& operator<<(bsl::ostream& os, const Properties& props);
125
126} // namespace rmqt
127} // namespace BloombergLP
128
129#endif
Properties is an minimal abstraction of the properties one can set on a message.
Definition: rmqt_properties.h:73
bdlb::NullableValue< bsl::string > userId
creating user id
Definition: rmqt_properties.h:113
bdlb::NullableValue< bdlt::Datetime > timestamp
message timestamp
Definition: rmqt_properties.h:107
bdlb::NullableValue< bsl::string > messageId
application message identifier
Definition: rmqt_properties.h:104
bdlb::NullableValue< bsl::string > contentEncoding
MIME content encoding.
Definition: rmqt_properties.h:78
bdlb::NullableValue< bsl::string > replyTo
address to reply to
Definition: rmqt_properties.h:98
bdlb::NullableValue< bsl::string > contentType
MIME content type.
Definition: rmqt_properties.h:75
bdlb::NullableValue< bsl::string > expiration
message expiration specification
Definition: rmqt_properties.h:101
bdlb::NullableValue< bsl::string > appId
creating application id
Definition: rmqt_properties.h:116
bdlb::NullableValue< bsl::uint8_t > deliveryMode
non-persistent (1) or persistent (2)
Definition: rmqt_properties.h:84
bdlb::NullableValue< bsl::string > type
message type name
Definition: rmqt_properties.h:110
bsl::shared_ptr< rmqt::FieldTable > headers
message header field table
Definition: rmqt_properties.h:81
bdlb::NullableValue< bsl::string > correlationId
application correlation identifier
Definition: rmqt_properties.h:90
bdlb::NullableValue< bsl::uint8_t > priority
message priority, 0 to 9
Definition: rmqt_properties.h:87