libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
bmqa_confirmeventbuilder.h
Go to the documentation of this file.
1 // Copyright 2016-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 // bmqa_confirmeventbuilder.h -*-C++-*-
17 #ifndef INCLUDED_BMQA_CONFIRMEVENTBUILDER
18 #define INCLUDED_BMQA_CONFIRMEVENTBUILDER
19 
101 
102 // BMQ
103 
104 #include <bmqa_message.h>
105 #include <bmqt_resultcode.h>
106 
107 // BDE
108 #include <bdlbb_blob.h>
109 #include <bsls_alignedbuffer.h>
110 
111 namespace BloombergLP {
112 
113 // FORWARD DECLARATION
114 namespace bmqp {
115 class ConfirmEventBuilder;
116 }
117 
118 namespace bmqa {
119 
120 // ==============================
121 // struct ConfirmEventBuilderImpl
122 // ==============================
123 
126 struct ConfirmEventBuilderImpl {
127  // CONSTANTS
128 
134  static const int k_MAX_SIZEOF_BMQP_CONFIRMEVENTBUILDER = 64;
135 
136  // PUBLIC DATA
137  // (for convenience)
138  bsls::AlignedBuffer<k_MAX_SIZEOF_BMQP_CONFIRMEVENTBUILDER> d_buffer;
139 
140  bmqp::ConfirmEventBuilder* d_builder_p;
141 
142  // CREATORS
143  ConfirmEventBuilderImpl();
144 
145  private:
146  // NOT IMPLEMENTED
147  ConfirmEventBuilderImpl(const ConfirmEventBuilderImpl&); // = delete
148  ConfirmEventBuilderImpl&
149  operator=(const ConfirmEventBuilderImpl&); // = delete
150 };
151 
152 // =========================
153 // class ConfirmEventBuilder
154 // =========================
155 
158  private:
159  // DATA
160  ConfirmEventBuilderImpl d_impl;
161 
162  private:
163  // NOT IMPLEMENTED
164 
166  ConfirmEventBuilder(const ConfirmEventBuilder& other); // = delete
168  operator=(const ConfirmEventBuilder& rhs); // = delete
169 
170  public:
171  // CREATORS
172 
177 
180 
181  // MANIPULATORS
182 
188  addMessageConfirmation(const Message& message);
189 
197 
200  void reset();
201 
202  // ACCESSORS
203 
207  int messageCount() const;
208 
214  const bdlbb::Blob& blob() const;
215 };
216 
217 // ============================================================================
218 // INLINE DEFINITIONS
219 // ============================================================================
220 
221 // ------------------------------
222 // struct ConfirmEventBuilderImpl
223 // ------------------------------
224 
225 // CREATORS
226 inline ConfirmEventBuilderImpl::ConfirmEventBuilderImpl()
227 : d_buffer()
228 , d_builder_p(0)
229 {
230  // NOTHING
231 }
232 
233 // -------------------------
234 // class ConfirmEventBuilder
235 // -------------------------
236 
237 // CREATORS
239 : d_impl()
240 {
241  // NOTHING
242 }
243 
244 // MANIPULATORS
247 {
248  return addMessageConfirmation(message.confirmationCookie());
249 }
250 
251 } // close package namespace
252 } // close enterprise namespace
253 
254 #endif
Provide the application with a message data object.
Provide enums for various publicly exposed result code.
Mechanism to build a batch of CONFIRM messages.
Definition: bmqa_confirmeventbuilder.h:157
const bdlbb::Blob & blob() const
~ConfirmEventBuilder()
Destroy this instance.
bmqt::EventBuilderResult::Enum addMessageConfirmation(const Message &message)
Definition: bmqa_confirmeventbuilder.h:246
ConfirmEventBuilder()
Definition: bmqa_confirmeventbuilder.h:238
bmqt::EventBuilderResult::Enum addMessageConfirmation(const MessageConfirmationCookie &cookie)
Cookie for async message confirmation.
Definition: bmqa_message.h:131
A message sent/received to/from the BlazingMQ broker.
Definition: bmqa_message.h:170
MessageConfirmationCookie confirmationCookie() const
Definition: bmqa_abstractsession.h:42
Enum
Definition: bmqt_resultcode.h:364