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