RMQ - RabbitMQ C++ Library
rmqt_queue.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_QUEUE
17#define INCLUDED_RMQT_QUEUE
18
19#include <rmqt_fieldvalue.h>
20
21#include <bsl_memory.h>
22#include <bsl_ostream.h>
23
24//@PURPOSE: Provide an AMQP Queue.
25//
26//@CLASSES:
27// rmqt::Queue: a RabbitMQ Queue API object
28
29namespace BloombergLP {
30namespace rmqt {
31
35
36class Queue {
37 public:
38 // CREATORS
42 explicit Queue(const bsl::string& name = bsl::string(),
43 bool passive = false,
44 bool autoDelete = false,
45 bool durable = true,
46 const rmqt::FieldTable& args = rmqt::FieldTable());
47
49 const bsl::string& name() const { return d_name; }
50
52 bool passive() const { return d_passive; }
53
55 bool autoDelete() const { return d_autoDelete; }
56
58 bool durable() const { return d_durable; }
59
61 const rmqt::FieldTable& arguments() const { return d_args; }
62
63 friend bsl::ostream& operator<<(bsl::ostream& os, const Queue& queue);
64
65 private:
66 // DATA
67 bsl::string d_name;
68 bool d_passive;
69 bool d_autoDelete;
70 bool d_durable;
71 rmqt::FieldTable d_args;
72}; // class Queue
73
74typedef bsl::weak_ptr<Queue> QueueHandle;
75
76bsl::ostream& operator<<(bsl::ostream& os, const Queue& queue);
77
78} // namespace rmqt
79} // namespace BloombergLP
80
81#endif // ! INCLUDED_RMQT_QUEUE
An AMQP Queue.
Definition: rmqt_queue.h:36
bool durable() const
Returns whether the queue is durable.
Definition: rmqt_queue.h:58
const bsl::string & name() const
Queue name.
Definition: rmqt_queue.h:49
bool passive() const
Returns whether the queue is passive.
Definition: rmqt_queue.h:52
Queue(const bsl::string &name=bsl::string(), bool passive=false, bool autoDelete=false, bool durable=true, const rmqt::FieldTable &args=rmqt::FieldTable())
Definition: rmqt_queue.cpp:23
bool autoDelete() const
Returns whether the queue is "auto-delete".
Definition: rmqt_queue.h:55
const rmqt::FieldTable & arguments() const
Optional queue arguments.
Definition: rmqt_queue.h:61
Represents AMQP 0.9.1 Field Table (dict of FieldValues)
Definition: rmqt_fieldvalue.h:108