RMQ - RabbitMQ C++ Library
rmqt_envelope.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_ENVELOPE
17#define INCLUDED_RMQT_ENVELOPE
18
19#include <bsl_cstdint.h>
20#include <bsl_ostream.h>
21#include <bsl_string.h>
22
23namespace BloombergLP {
24namespace rmqt {
25
31
32class Envelope {
33 public:
44 Envelope(uint64_t deliveryTag,
45 size_t channelLifetimeId,
46 const bsl::string& consumerTag,
47 const bsl::string& exchange,
48 const bsl::string& routingKey,
49 bool redelivered);
50
52 uint64_t deliveryTag() const { return d_deliveryTag; }
53
56 size_t channelLifetimeId() const { return d_channelLifetimeId; }
57
59 const bsl::string& consumerTag() const { return d_consumerTag; }
60
62 const bsl::string& exchange() const { return d_exchange; }
63
65 const bsl::string& routingKey() const { return d_routingKey; }
66
68 bool redelivered() const { return d_redelivered; }
69
70 private:
71 uint64_t d_deliveryTag;
72 size_t d_channelLifetimeId;
73 bsl::string d_consumerTag;
74 bsl::string d_exchange;
75 bsl::string d_routingKey;
76 bool d_redelivered;
77};
78
79bsl::ostream& operator<<(bsl::ostream& os, const rmqt::Envelope& envelope);
80
81} // namespace rmqt
82} // namespace BloombergLP
83
84#endif
Provide a class that holds additional data about rmqt::Message.
Definition: rmqt_envelope.h:32
const bsl::string & consumerTag() const
Consumer tag.
Definition: rmqt_envelope.h:59
Envelope(uint64_t deliveryTag, size_t channelLifetimeId, const bsl::string &consumerTag, const bsl::string &exchange, const bsl::string &routingKey, bool redelivered)
Envelope constructor. Only to be called by rmqcpp internals.
Definition: rmqt_envelope.cpp:22
const bsl::string & routingKey() const
AMQP routing key.
Definition: rmqt_envelope.h:65
bool redelivered() const
True if the message has been redelivered.
Definition: rmqt_envelope.h:68
size_t channelLifetimeId() const
Identifier of channel lifetime id (increases after every reconnect)
Definition: rmqt_envelope.h:56
uint64_t deliveryTag() const
Message delivery tag.
Definition: rmqt_envelope.h:52
const bsl::string & exchange() const
AMQP exchange name.
Definition: rmqt_envelope.h:62