Quick Links: |
#include <bmqa_messageeventbuilder.h>
Public Member Functions | |
MessageEventBuilder () | |
~MessageEventBuilder () | |
MessageEventBuilder (const MessageEventBuilder &) | |
MessageEventBuilder & | operator= (const MessageEventBuilder &) |
Message & | startMessage () |
bmqt::EventBuilderResult::Enum | packMessage (const bmqa::QueueId &queueId) |
void | reset () |
const MessageEvent & | messageEvent () |
Message & | currentMessage () |
int | messageCount () const |
int | messageEventSize () const |
A builder for MessageEvent
objects.
See Component bmqa_messageeventbuilder
bmqa::MessageEventBuilder::MessageEventBuilder | ( | ) | [explicit] |
Create an invalid instance. Application should not create MessageEventBuilder
themselves, but ask the bmqa::Session
to give them one, by using bmqa::Session::loadMessageEventBuilder
.
bmqa::MessageEventBuilder::~MessageEventBuilder | ( | ) |
Destructor
bmqa::MessageEventBuilder::MessageEventBuilder | ( | const MessageEventBuilder & | ) |
MessageEventBuilder& bmqa::MessageEventBuilder::operator= | ( | const MessageEventBuilder & | ) |
Copy constructor and assignment operator
Message& bmqa::MessageEventBuilder::startMessage | ( | ) |
Reset the current message being built, and return a reference to the current message. Note that returned Message
is valid until this builder is reset or destroyed. Behavior is undefined if this builder was earlier used to build an event and has not been reset since then.
bmqt::EventBuilderResult::Enum bmqa::MessageEventBuilder::packMessage | ( | const bmqa::QueueId & | queueId | ) |
Add the current message into the message event under construction, setting the destination queue of the current message to match the specified queueId
. Return zero on success, non-zero value otherwise. In case of failure, this method has no effect on the underlying message event being built. The behavior is undefined unless all mandatory attributes of the current Message have been set, and queueId
is valid and has been opened in WRITE mode. The result is one of the values from the bmqt::EventBuilderResult::Enum
enum. Note that this method can be called multiple times in a row with different queueId
if the application desires to post the same bmqa::Message
to multiple queues: all attributes on the message are unchanged, exception for the correlationId
which is cleared.
void bmqa::MessageEventBuilder::reset | ( | ) |
Reset the builder, effectively discarding the MessageEvent
under construction.
const MessageEvent& bmqa::MessageEventBuilder::messageEvent | ( | ) |
Return the MessageEvent
that was built. Note that returned MessageEvent
is valid until this builder is reset or destroyed, calling this method multiple times in a row will return the same bmqa::MessageEvent instance. Also note that this builder must be reset before calling startMessage
again.
Message& bmqa::MessageEventBuilder::currentMessage | ( | ) |
Return a reference to the current message.
int bmqa::MessageEventBuilder::messageCount | ( | ) | const |
Return the number of messages currently in the MessageEvent being built.
int bmqa::MessageEventBuilder::messageEventSize | ( | ) | const |
Return the size in bytes of the event built after last successful call to packMessage()
, otherwise return zero. Note that returned value represents the length of entire message event, including BlazingMQ wire protocol overhead.