Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 » QAnywhere » QAnywhere Reference » QAnywhere Java API reference » QAnywhere Java API for clients

 

QABinaryMessage interface

Syntax
public QABinaryMessage
Base classes
Remarks

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

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

When the message is first created, the body of the message is in write-only mode. 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 QABinaryMessage.reset() so that the message body is in read-only mode and reading of values starts from the beginning of the message body.

The following example uses the QABinaryMessage.writeString(String) 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.
try {
    qa_manager.putMessage("store-id\\queue-name", binary_message);
}
catch (QAException e) {
    handleError();
}

On the receiving end, the first QABinaryMessage.readString() invocation returns "Q" and the next QABinaryMessage.readString() invocation returns "Anywhere".

The message is sent by the QAnywhere Agent.

See Also

QAMessage interface

readString method

Members

All members of ianywhere.qanywhere.client.QABinaryMessage, including all inherited members.


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