RMQ - RabbitMQ C++ Library
rmqa_consumer.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// rmqa_consumer.h
17#ifndef INCLUDED_RMQA_CONSUMER
18#define INCLUDED_RMQA_CONSUMER
19
20#include <rmqa_messageguard.h>
21#include <rmqa_topologyupdate.h>
22
23#include <rmqp_consumer.h>
24#include <rmqp_topologyupdate.h>
25#include <rmqt_future.h>
26#include <rmqt_message.h>
27#include <rmqt_result.h>
28
29#include <bsl_functional.h>
30#include <bslma_managedptr.h>
31
32namespace BloombergLP {
33namespace rmqa {
34
40
41class Consumer {
42 public:
43 // INNER CLASSES
50 explicit Consumer(bslma::ManagedPtr<rmqp::Consumer>& impl);
51
55 void cancel();
56
69 cancelAndDrain(const bsls::TimeInterval& timeout = bsls::TimeInterval(0));
70
80 updateTopology(const rmqa::TopologyUpdate& topologyUpdate,
81 const bsls::TimeInterval& timeout = bsls::TimeInterval(0));
82
83 class Factory;
84 // Internal implementation used by Connection.
85
86 // CREATORS
88 ~Consumer();
89
90 private:
91 Consumer(const Consumer&) BSLS_KEYWORD_DELETED;
92 Consumer& operator=(const Consumer&) BSLS_KEYWORD_DELETED;
93
94 private:
95 bslma::ManagedPtr<rmqp::Consumer> d_impl;
96}; // class Consumer
97
98} // namespace rmqa
99} // namespace BloombergLP
100
101#endif // ! INCLUDED_RMQA_CONSUMER
Provide a RabbitMQ Async Consumer API.
Definition: rmqa_consumer.h:41
Consumer(bslma::ManagedPtr< rmqp::Consumer > &impl)
Definition: rmqa_consumer.cpp:29
rmqt::Result cancelAndDrain(const bsls::TimeInterval &timeout=bsls::TimeInterval(0))
Tells the broker to stop delivering messages to this consumer.
Definition: rmqa_consumer.cpp:42
rmqt::Result updateTopology(const rmqa::TopologyUpdate &topologyUpdate, const bsls::TimeInterval &timeout=bsls::TimeInterval(0))
Definition: rmqa_consumer.cpp:49
void cancel()
Tells the broker to stop delivering messages to this consumer. it's still possible to nack/ack messag...
Definition: rmqa_consumer.cpp:34
~Consumer()
Destructor stops the consumer.
Definition: rmqa_consumer.cpp:64
Definition: rmqa_topologyupdate.h:27
A result of an operation.
Definition: rmqt_result.h:37