RMQ - RabbitMQ C++ Library
rmqp_messageguard.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_RMQP_MESSAGEGUARD
17#define INCLUDED_RMQP_MESSAGEGUARD
18
19#include <rmqt_consumerack.h>
20#include <rmqt_message.h>
21
22#include <bsl_functional.h>
23#include <bsl_memory.h>
24
25namespace BloombergLP {
26namespace rmqp {
27class Consumer;
28class MessageGuard;
29
30typedef bsl::shared_ptr<MessageGuard> TransferrableMessageGuard;
31
38
40 public:
41 typedef bsl::function<void(const rmqt::ConsumerAck&)> MessageGuardCallback;
42
43 virtual ~MessageGuard();
44
46 virtual const rmqt::Message& message() const = 0;
47
49 virtual const rmqt::Envelope& envelope() const = 0;
50
53 virtual void ack() = 0;
54
59 virtual void nack(bool requeue = true) = 0;
60
62 virtual Consumer* consumer() const = 0;
63
69 virtual TransferrableMessageGuard transferOwnership() = 0;
70
71 private:
72 MessageGuard& operator=(const MessageGuard& other);
73
74}; // class MessageGuard
75
76} // namespace rmqp
77} // namespace BloombergLP
78
79#endif // ! INCLUDED_RMQP_MESSAGEGUARD
Provide a RabbitMQ Async Consumer API.
Definition: rmqp_consumer.h:38
An interface for MessageGuard class.
Definition: rmqp_messageguard.h:39
virtual const rmqt::Message & message() const =0
Access the received message.
virtual const rmqt::Envelope & envelope() const =0
Access the received message envelope (delivery details)
virtual Consumer * consumer() const =0
Reference to the Consumer.
virtual TransferrableMessageGuard transferOwnership()=0
virtual void nack(bool requeue=true)=0
Definition: rmqt_consumerack.h:24
Provide a class that holds additional data about rmqt::Message.
Definition: rmqt_envelope.h:32
An AMQP content message.
Definition: rmqt_message.h:43