Message Properties - Examples
In all cases, a defined constant allows the property name to be carried in a single byte. For example, priority (if present) affects the order in which messages are transmitted, correlation ID triggers indexing of a queue for fast retrieval of information, expire time triggers the expiry of the message, and so on. Also, the default message dump command minimizes the size of the generated byte string for more efficient message storage and transmission.
MQeMsgObject msgObj = new MQeMsgObject; msgObj.putArrayOfByte( MQe.Msg_ID, MQe.asciiToByte( "1234" ));
rc = mqeFields_putArrayOfByte(hMsg,&exceptBlock, MQE_MSG_MSGID,pByteArray,sizeByteArray);
MQeMsgObject msgObj = new MQeMsgObject(); msgObj.putByte( MQe.Msg_Priority, (byte)8 );
rc = mqeFields_putByte(hsg,&exceptBlock, MQE_MSG_PRIORITY, (MQEBYTE)8);
MQeMsgObject msgObj = new MQeMsgObject(); msgObj.putAscii( "PartNo", "Z301" ); msgObj.putAscii( "Colour", "Blue" ); msgObj.putInt( "Size", 350 );
MQeFieldsHndl hPartMsg; MQeStringHndl hSize_FieldLabel; rc = mqeFields_new(&exceptBlock,&hPartMsg); rc = mqeString_newUtf8(&exceptBlock, &hSize_FieldLabel,"Size"); rc = mqeFields_putInt32(hPartMsg, &exceptBlock,hSize_FieldLabel,350);
package messages.order; import com.ibm.mqe.*; /*** This class defines the Order Request format */ public class OrderRequestMsg extends MQeMsgObject { public OrderRequestMsg() throws Exception { } /*** This method sets the client number */ public void setClientNo(long aClientNo) throws Exception { putLong("ClientNo", aClientNo); } /*** This method returns the client number */ public long getClientNo() throws Exception { return getLong("ClientNo"); }
To find out the length of a message, you can enumerate on the message as each data type has methods for getting its length.