Author |
Message
|
wyatt |
Posted: Thu Jul 12, 2007 3:31 pm Post subject: Create Message Groups |
|
|
Voyager
Joined: 28 Nov 2004 Posts: 76
|
How does one go about creating a message that is part of a "MQSeries Message Group". Using MQSeries API the recommend approach is to set the message put option to MQPMO_LOGICAL_ORDER.
Is there equivalent in Message Broker.
This posts demonstrates use of OutputLocalEnvironment to set MQGET parameters. Can same pattern be used for MQPUT?
The Message Broker information Center doesnt describe this approach.
http://www.mqseries.net/phpBB2/viewtopic.php?t=37131&highlight=outputlocalenvironment+mq |
|
Back to top |
|
 |
wyatt |
Posted: Fri Jul 13, 2007 10:55 am Post subject: |
|
|
Voyager
Joined: 28 Nov 2004 Posts: 76
|
The following code :
======================================
Set Environment.currentOffSet = 1;
WHILE (Environment.currentOffSet < iMsgLen) DO
CALL CopyMessageHeaders();
/*copy message payload to output tree*/
SET OutputRoot.BLOB.BLOB = SUBSTRING(InputRoot.BLOB.BLOB from Environment.currentOffSet for msgSegSize);
SET Environment.currentOffSet = Environment.currentOffSet + msgSegSize; --while counter
--CALL setupCommonOutputMQMD(); --setup MQMD properties
--CALL setupCommonOutputTree(); --setup options for message groups
/*message group sequence number housekeeping*/
SET OutputRoot.MQMD.MsgSeqNumber = indx;
SET indx = indx + 1;
SET OutputLocalEnvironment.Destination.MQDestinationList.Defaults.MsgFlags = MQPMO_LOGICAL_ORDER;
SET OutputLocalEnvironment.Destination.MQDestinationList.Defaults.GroupId = 'xxx';
SET OutputLocalEnvironment.MQ.PUT.MQPMO.MsgFlags = MQPMO_LOGICAL_ORDER;
SET OutputLocalEnvironment.Destination.MQDestinationList.DestinationData[1].queueName = 'SYSTEM.DEFAULT.LOCAL.QUEUE';
PROPAGATE;
END WHILE;
===============================
Results in error:
An MQ output node with the "Destination Mode" property set to "list" received a message containing a distribution list. However the "Defaults" or "DestinationData" folder contained an field with an invalid value. Only specific values are allowed in this situation.
This is somewhat encouraging as the MsgFlags are recognized by still cant create message groups?
Any suggestions? |
|
Back to top |
|
 |
wbi_telecom |
Posted: Fri Jul 13, 2007 11:42 am Post subject: |
|
|
 Disciple
Joined: 15 Feb 2006 Posts: 188 Location: Harrisburg, PA
|
I think its failing because the values that you have under Defaults folder are not valid. Check out the topic on "Data types for elements in the DestinationData subtree" in infocenter. It gives table that has valid values and their datatypes.
Cheers, |
|
Back to top |
|
 |
wyatt |
Posted: Fri Jul 13, 2007 11:55 am Post subject: |
|
|
Voyager
Joined: 28 Nov 2004 Posts: 76
|
True, I did see the list of "valid" fields. But they did not include "put message options". Dont know how to create message group without them.... |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jul 13, 2007 3:18 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
wyatt wrote: |
True, I did see the list of "valid" fields. But they did not include "put message options". Dont know how to create message group without them.... |
Wouldn't you set that information on the MQMD before the output node in a compute node ??  _________________ MQ & Broker admin |
|
Back to top |
|
 |
TonyD |
Posted: Fri Jul 13, 2007 4:08 pm Post subject: |
|
|
Knight
Joined: 15 May 2001 Posts: 540 Location: New Zealand
|
This piece of ESQL writes multiple messages that form a logical group (I think ... I haven't run it lately):
Code: |
CREATE COMPUTE MODULE mfLogGrpPut_V6_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
DECLARE NumOfEmps INTEGER CARDINALITY(InputRoot.XML.DeptMsg.ListOfEmployees.Employee[]);
DECLARE EmpCnt INTEGER 1;
WHILE EmpCnt <= NumOfEmps DO
SET OutputRoot = InputRoot;
SET OutputRoot.XML = NULL;
SET OutputRoot.MQMD.MsgType = MQMT_REPLY;
SET OutputRoot.MQMD.MsgId = CAST('50524D534E5A524D' as blob) || UUIDASBLOB;
SET OutputRoot.MQMD.CorrelId = CAST('50524D534E5A524D' as blob) || UUIDASBLOB;
SET OutputRoot.MQMD.GroupId = CAST(X'313131313131313132323232323232323333333333333333' AS BLOB);
SET OutputRoot.MQMD.MsgSeqNumber = EmpCnt;
SET OutputRoot.MQMD.MsgFlags = 8;
IF EmpCnt = NumOfEmps THEN
SET OutputRoot.MQMD.MsgFlags = 24;
END IF;
SET OutputRoot.XML.DeptMsg.Employee = InputRoot.XML.DeptMsg.ListOfEmployees.Employee[EmpCnt];
PROPAGATE;
SET EmpCnt = EmpCnt + 1;
END WHILE;
RETURN FALSE;
END;
|
The example reads a single MQ XML message that has multiple 'ListOfEmployees.Employee' elements and writes one MQ message for each employee. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jul 14, 2007 4:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Looking at the above example:
I would never set the MsgId unless I absolutely need to...
And yes I know the example is out of context so apologies if I offended anybody...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
wyatt |
Posted: Mon Jul 16, 2007 6:05 am Post subject: |
|
|
Voyager
Joined: 28 Nov 2004 Posts: 76
|
Interesting, when I execute a similiar piece of code, the message(s) is written to the replyToQ queue but the "GroupId", "MsgSeqNumber" and "MsgFlags" are not propagated to the output message. Basically they are ignored. That is why I started looking into the DestinationList approach.
Do you have other settings/configuration that instruct the broker to use the MQMD values as coded? |
|
Back to top |
|
 |
wyatt |
Posted: Mon Jul 16, 2007 10:49 am Post subject: |
|
|
Voyager
Joined: 28 Nov 2004 Posts: 76
|
the "message grouping" works when the MQOutput Node -> Destination Mode is set to "Queue Name". For some reason, when MQOutput Node -> Destination Mode is set to "Destination List" the message group fields are overridden. Anyone know what that might be? |
|
Back to top |
|
 |
wyatt |
Posted: Mon Jul 16, 2007 10:52 am Post subject: |
|
|
Voyager
Joined: 28 Nov 2004 Posts: 76
|
..sorry, when using "Reply To Queue" it does not work... |
|
Back to top |
|
 |
wyatt |
Posted: Sun Mar 16, 2008 7:48 am Post subject: DestinationData |
|
|
Voyager
Joined: 28 Nov 2004 Posts: 76
|
Using a DestinationList has advantages in that you can dynamically select the target queue name. The information center does not enumerate DestinationData fields such as MQMD.GroupID. Does anyone know if these fields can be modified in DestinationData? |
|
Back to top |
|
 |
|