QABinaryMessage class

Syntax
public QABinaryMessage
Base classes
Remarks

A QABinaryMessage object is used to send a message containing a stream of uninterpreted bytes.

It inherits from the QAMessage class and adds a bytes message body. QABinaryMessage provides a variety of methods to read from and write to the bytes message body.

When the message is first created, the body of the message is write-only. After a message has been sent, the client that sent it can retain and modify it without affecting the message that has been sent. The same message object can be sent multiple times.

When a message is received, the provider has called the QABinaryMessagereset method so that the message body is in read-only mode and reading of values starts from the beginning of the message body. If a client attempts to write a message in read-only mode, a COMMON_MSG_NOT_WRITEABLE_ERROR is set.

The following example uses the QABinaryMessagewriteString method to write the string "Q" followed by the string "Anywhere" to a QABinaryMessage instance's message body.

 // Create a binary message instance.
 QABinaryMessage * binary_message;
 binary_message = qa_manager->createBinaryMessage();
 // Set optional message properties.
 binary_message->setReplyToAddress( "my-queue-name" );
 // Write to the message body.
 binary_message->writeString("Q");
 binary_message->writeString("Anywhere");
 // Put the message in the local database, ready for sending.
 if( !qa_manager->putMessage( "store-id\\queue-name", msg ) ) {
         handleError();
     }
 

Note: On the receiving end, the first QABinaryMessagereadString() invocation returns "Q" and the next QABinaryMessagereadString() invocation returns "Anywhere".

The message is sent by the QAnywhere Agent.

For more information, see Determining when message transmission should occur on the client andWriting QAnywhere client applications.

Members

All members of QABinaryMessage, including all inherited members.


getBodyLength function
readBinary function
readBoolean function
readByte function
readChar function
readDouble function
readFloat function
readInt function
readLong function
readShort function
readString function
reset function
writeBinary function
writeBoolean function
writeByte function
writeChar function
writeDouble function
writeFloat function
writeInt function
writeLong function
writeShort function
writeString function
~QABinaryMessage function