RMQ - RabbitMQ C++ Library
rmqa_tracingmessageguard.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_RMQA_TRACINGMESSAGEGUARD
17#define INCLUDED_RMQA_TRACINGMESSAGEGUARD
18
19#include <rmqa_messageguard.h>
20
21#include <rmqp_consumertracing.h>
22
23#include <rmqt_consumerack.h>
24#include <rmqt_envelope.h>
25#include <rmqt_message.h>
26#include <rmqt_queue.h>
27
28#include <bsl_memory.h>
29#include <bslma_managedptr.h>
30#include <bsls_keyword.h>
31
32namespace BloombergLP {
33namespace rmqa {
34
45
47 public:
49 public:
50 Factory(const rmqt::QueueHandle& queue,
51 const bsl::shared_ptr<const rmqt::Endpoint>& endpoint,
52 const bsl::shared_ptr<rmqp::ConsumerTracing>& contextFactory);
53
54 virtual bslma::ManagedPtr<rmqa::MessageGuard>
55 create(const rmqt::Message& message,
57 const MessageGuardCallback& ackCallback,
58 rmqp::Consumer* consumer) const BSLS_KEYWORD_OVERRIDE;
59
60 private:
61 bsl::string d_queueName;
62 bsl::shared_ptr<const rmqt::Endpoint> d_endpoint;
63 bsl::shared_ptr<rmqp::ConsumerTracing> d_contextFactory;
64 };
65
71 rmqp::TransferrableMessageGuard transferOwnership() BSLS_KEYWORD_OVERRIDE;
72
79 const rmqt::Message& message,
80 const rmqt::Envelope& envelope,
81 const MessageGuardCallback& ackCallback,
82 rmqp::Consumer* consumer,
83 const bsl::string& queueName,
84 const bsl::shared_ptr<const rmqt::Endpoint>& endpoint,
85 const bsl::shared_ptr<rmqp::ConsumerTracing>& contextFactory);
86
90
91 private:
92 bsl::shared_ptr<rmqp::ConsumerTracing::Context> d_context;
93}; // class TracingMessageGuard
94
95} // namespace rmqa
96} // namespace BloombergLP
97
98#endif // ! INCLUDED_RMQA_TRACINGMESSAGEGUARD
Provide a RabbitMQ Async Consumer API.
Definition: rmqa_consumer.h:41
Definition: rmqa_messageguard.h:47
Controls acknowledgements passed to broker for consumed messages.
Definition: rmqa_messageguard.h:45
virtual rmqp::Consumer * consumer() const BSLS_KEYWORD_OVERRIDE
Pointer to the Consumer, e.g. to cancel the message flow.
Definition: rmqa_messageguard.cpp:104
const rmqt::Message & message() const BSLS_KEYWORD_OVERRIDE
Access the received message.
Definition: rmqa_messageguard.cpp:102
const rmqt::Envelope & envelope() const BSLS_KEYWORD_OVERRIDE
Access the received message envelope (delivery details)
Definition: rmqa_messageguard.cpp:103
Definition: rmqa_tracingmessageguard.h:48
Controls acknowledgements passed to broker for consumed messages.
Definition: rmqa_tracingmessageguard.h:46
rmqp::TransferrableMessageGuard transferOwnership() BSLS_KEYWORD_OVERRIDE
Definition: rmqa_tracingmessageguard.cpp:80
Provide a RabbitMQ Async Consumer API.
Definition: rmqp_consumer.h:38
Provide a class that holds additional data about rmqt::Message.
Definition: rmqt_envelope.h:32
An AMQP content message.
Definition: rmqt_message.h:43