libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
BloombergLP::bmqa::MessageEventBuilder Class Reference

A builder for MessageEvent objects.

#include <bmqa_messageeventbuilder.h>

Public Member Functions

 MessageEventBuilder ()
 
MessagestartMessage ()
 
bmqt::EventBuilderResult::Enum packMessage (const bmqa::QueueId &queueId)
 
void reset ()
 
const MessageEventmessageEvent ()
 
MessagecurrentMessage ()
 Return a reference to the current message. More...
 
int messageCount () const
 
int messageEventSize () const
 

Constructor & Destructor Documentation

◆ MessageEventBuilder()

BloombergLP::bmqa::MessageEventBuilder::MessageEventBuilder ( )

Create an invalid instance. Application should not create MessageEventBuilder themselves, but ask the bmqa::Session to give them one, by using bmqa::Session::loadMessageEventBuilder.

Member Function Documentation

◆ startMessage()

Message& BloombergLP::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.

◆ packMessage()

bmqt::EventBuilderResult::Enum BloombergLP::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.

◆ reset()

void BloombergLP::bmqa::MessageEventBuilder::reset ( )

Reset the builder, effectively discarding the MessageEvent under construction.

◆ messageEvent()

const MessageEvent& BloombergLP::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.

◆ currentMessage()

Message& BloombergLP::bmqa::MessageEventBuilder::currentMessage ( )

◆ messageCount()

int BloombergLP::bmqa::MessageEventBuilder::messageCount ( ) const

Return the number of messages currently in the MessageEvent being built.

◆ messageEventSize()

int BloombergLP::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.


The documentation for this class was generated from the following file: