libbmq 57a4779af25c7e9db2550c596f277dd91da7e3c2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bmqa_messageeventbuilder.h
Go to the documentation of this file.
1// Copyright 2014-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_messageeventbuilder.h -*-C++-*-
17#ifndef INCLUDED_BMQA_MESSAGEEVENTBUILDER
18#define INCLUDED_BMQA_MESSAGEEVENTBUILDER
19
20// Clang-format warns about an overlong line in this comment, which gives a
21// Markdown anchor to a header. Unfortunately, by Markdown syntax rules, this
22// has to on the same line as the header, meaning we cannot introduce a
23// line-break here.
24
25// clang-format off
26
252
253// clang-format on
254
255// BMQ
256
257#include <bmqa_message.h>
258#include <bmqa_messageevent.h>
259#include <bmqt_resultcode.h>
260
261// BDE
262#include <bsl_memory.h>
263
264namespace BloombergLP {
265
266// FORWARD DECLARATION
267namespace bmqa {
268class QueueId;
269}
270namespace bmqp {
271class MessageGUIDGenerator;
272}
273
274namespace bmqa {
275
276// ==============================
277// struct MessageEventBuilderImpl
278// ==============================
279
285struct MessageEventBuilderImpl {
286 // PUBLIC DATA
287
289 MessageEvent d_msgEvent;
290
292 Message d_msg;
293
294 // GUID generator object.
295 bsl::shared_ptr<bmqp::MessageGUIDGenerator> d_guidGenerator_sp;
296
297 // The final number of messages in the current 'd_msgEvent' cached on
298 // switching this MessageEvent from WRITE to READ mode.
299 // This cached value exists because we are not able to access the
300 // underlying PutEventBuilder once downgraded to READ.
301 // CONTRACT: the stored value is correct every moment when in READ mode,
302 // and the value is not guaranteed to be correct when in WRITE mode.
303 int d_messageCountFinal;
304
305 // The final message event size of the current 'd_msgEvent' cached on
306 // switching this MessageEvent from WRITE to READ mode.
307 // This cached value exists because we are not able to access the
308 // underlying PutEventBuilder once downgraded to READ.
309 // CONTRACT: the stored value is correct every moment when in READ mode,
310 // and the value is not guaranteed to be correct when in WRITE mode.
311 int d_messageEventSizeFinal;
312};
313
314// =========================
315// class MessageEventBuilder
316// =========================
317
320 private:
321 // DATA
322 MessageEventBuilderImpl d_impl; // Impl
323
324 public:
325 // CREATORS
326
331
332 // MANIPULATORS
333
340
355
358 void reset();
359
366
369
370 // ACCESSORS
371
374 int messageCount() const;
375
380 int messageEventSize() const;
381};
382
383} // close package namespace
384} // close enterprise namespace
385
386#endif
Provide the application with a message data object.
Provide the application with data event notifications.
Provide enums for various publicly exposed result code.
A builder for MessageEvent objects.
Definition bmqa_messageeventbuilder.h:319
bmqt::EventBuilderResult::Enum packMessage(const bmqa::QueueId &queueId)
Message & currentMessage()
Return a reference to the current message.
const MessageEvent & messageEvent()
Definition bmqa_messageevent.h:64
A message sent/received to/from the BlazingMQ broker.
Definition bmqa_message.h:170
Value-semantic efficient identifier for a queue.
Definition bmqa_queueid.h:59
Definition bmqa_abstractsession.h:42
Enum
Definition bmqt_resultcode.h:364