The payload is set by using the
Before content is added, the message object must be initialized for sending. Do this by calling the
The
One of the main uses of tuples is to make it easy to serialize an object by copying its properties into a message. Most primitive type property values are converted to UTF8 text apart from Binary values, which do not need to be converted and are sent as is. References are handled by serializing the oid value.
The following code fragment shows a message being constructed from name-value tuples.
// initialize the message
message := queue.createMessage(true);
// describe the type of data in the payload
message.format := "JadeTpls";
// set message payload
message.appendBodyTuple("color", "Green");
message.appendBodyTuple("height", 200);
message.appendBodyTuple("width", 300);
message.appendBodyTuple("new", false);
// insert message in queue
message.inspectModal;
queue.putMessage(message, null);
queue.putMessage(message, null);
The first time the
When the message is retrieved and the value of the
reply.getBodyTuple("color", any);
// value of 'color' tuple is any.String
reply.getBodyTuple("height", any);
// value of 'height' tuple any.Integer
reply.getBodyTuple("new", any);
// value of 'new' tuple any.Boolean