Start of change

Sending messages in a WebSphere MQ message group

The MQOutput node can send multiple messages that form a WebSphere® MQ message group. Configure a Compute node to set the MQMD fields to specify message group options.

The message flow must set the following MQMD fields:
  • GroupId
  • MsgSeqNumber
  • MsgFlags
You can use the following example ESQL in a Compute node. It shows how to set these fields:
DECLARE MSGNUM INT 0;
  DECLARE MSGTOTAL INT 5;
  WHILE MSGNUM < MSGTOTAL DO
    SET MSGNUM = MSGNUM + 1;
    CALL CopyMessageHeaders();
    -- Manually set the groupId since we cant ask the queue manager to generate one.
    -- the UUIDASBLOB function could be used here to generate one, but this must be done
    -- outside the loop to keep the same groupId throughout!
    SET OutputRoot.MQMD.GroupId = X'000000000000000000000000000000000000000000000001';
    SET OutputRoot.MQMD.MsgSeqNumber = MSGNUM;
    SET OutputRoot.MQMD.MsgFlags = MQMF_MSG_IN_GROUP;
    IF (MSGNUM = MSGTOTAL) THEN
      SET OutputRoot.MQMD.MsgFlags = MQMF_LAST_MSG_IN_GROUP;
    END IF;
    SET OutputRoot.XML.TestCase = MSGNUM;
    PROPAGATE;
  END WHILE;
  RETURN FALSE;

If the message flow is sending multiple messages from one input message, it can create a GroupId value, increment the MsgSeqNumber value, and set the MsgFlags field. The example ESQL shows how you can do this. However, if the message flow is sending multiple messages from more than one input message, it needs to store the GroupId and MsgSeqNumber values between flow instances; this can be achieved by using shared variables.

For more information about message grouping, see the Application Programming Guide section of the WebSphere MQ Version 6 information center online, or the Version 5.3 book on the WebSphere MQ library Web page. For more information about the WebSphere MQ fields that are significant in message grouping, see the Application Programming Reference section of the WebSphere MQ Version 6 information center online, or the Version 5.3 book on the WebSphere MQ library Web page.

Related reference
MQOutput node
Related information
WebSphere MQ Version 6 information center online
WebSphere MQ library Web page
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2009Copyright IBM Corporation 1999, 2009. All Rights Reserved.
Last updated : 2009-01-07 15:39:58

ac25710_

End of change