Provide a builder for batching confirmation messages.
More...
Namespaces |
namespace | bmqp |
namespace | bmqa |
Detailed Description
- Outline
-
-
- Purpose:
- Provide a builder for batching confirmation messages.
-
- Classes:
-
-
- Description:
- This component implements a mechanism,
bmqa::ConfirmEventBuilder
, that can be used for batching CONFIRM messages. The resulting batch can be sent to the BlazingMQ broker using the bmqa::Session
(refer to bmqa_session
for details). Wherever possible, a BlazingMQ consumer should try to send a batch of CONFIRM messages, which is more efficient than confirming messages individually.
- The builder holds a batch of CONFIRM messages under construction, and provides two flavors of
addMessageConfirmation
method to add a CONFIRM message to the batch. It also provides a routine to retrieve number of CONFIRM messages added to the batch. Once application is done creating the batch, it can retrieve the blob (wire-representation) of the batch and send it via bmqa::Session
. See Usage
section for more details.
-
- Usage:
-
An instance of bmqa::ConfirmEventBuilder (the builder) can be used to create multiple batches of CONFIRM messages. The recommended approach is to create one instance of the builder and use it throughout the lifetime of the task (if the task is multi-threaded, an instance per thread must be created and maintained). See usage example #1 for an illustration.
-
The lifetime of an instance of the builder is bound by the bmqa::Session from which it was created. In other words, bmqa::Session instance must outlive the builder instance.
-
- Example 1 - Basic Usage:
-
-
- Thread Safety:
- This component is NOT thread safe. If it is desired to create a batch of CONFIRM messages from multiple threads, an instance of the builder must be created and maintained per thread.