Author |
Message
|
Kjell |
Posted: Sun Nov 16, 2003 12:56 pm Post subject: MQ Message Groups from eSQL? |
|
|
Acolyte
Joined: 26 Feb 2002 Posts: 73
|
Hi, consider this situation:
1 I get one big message to the MQInput node. Essentially this is a file with thousands of records, sent as one single MQ message.
2. I have a node where I split the message into one message for each record, using eSQL. I PROPAGATE them one by one.
3. It's a requirement to guarantee that the receiving node can read all the messages in one sequence, so I need to use MQ Message Groups.
For each message I propagate I set OutputRoot. MQMD.Msgflag = 8 (meaning message belongs to a group) except for the last record where I set this flag to 24 (meaning last message of the group).
Now to my problem: When I do as above MQ seems to generate a new ID for each record! I don't want this. I want them all to belong to the same MsgGroup.
I have tried to set the field MQMD.MsgGroupID. It's tricky because it expects a BLOB, and it has to be 10 digits.
OR, maybe I got it all wrong? Maybe it's some setting on the MQOutput node that sets all this?
Anyone?
Regards Kjell |
|
Back to top |
|
 |
EddieA |
Posted: Mon Nov 17, 2003 10:21 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Don't think you can tell WMQI to use the MQ Groups for output. Probably because there's no correlation between messages. The Output node doesn't know they all came from one input message.
Why is setting a GroupId a problem. Just take something unique, like a TimeStamp, and cast it as a BLOB and SUBSTRING it. But even if you do this, I seem to remember someone else in this forum saying it still doesn't work. But try.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
Tibor |
Posted: Mon Nov 17, 2003 3:51 pm Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Kjell, if you aren't sure about your GroupId, use the MsgId of original message. This is unique and BLOB .
MsgFlags advice: using constants is more readable, e.g.
Code: |
SET OutputRoot.MQMD.MsgFlags=MQMF_MSG_IN_GROUP;
-- and
SET OutputRoot.MQMD.MsgFlags=MQMF_MSG_IN_GROUP + MQMF_LAST_MSG_IN_GROUP; |
|
|
Back to top |
|
 |
Kjell |
Posted: Tue Nov 18, 2003 2:31 am Post subject: |
|
|
Acolyte
Joined: 26 Feb 2002 Posts: 73
|
Hi and thanks for your advices.
I still do not have it work. The reason seems to be that MQ updates the GroupID field probably AFTER the compute node as to where the GroupID is set by my eSQL.
I tried:
DECLARE savemsggroup;
- For the 1st message
- PROPAGATE;
- SET Savemsggroup = OutputRoot.MQMD.MsgGroupID;
for the rest of the messages
- SET OutputRoot.MQMD.MsgGroupID = Savemsggroup;
- PROPAGATE;
It does not work. When landing at the output queue they all have individual GroupID:s anyhow.
My gut feeling is that I have to do something with the MQOutput node to have it set the proper Put Option, but... how to do it?
Regards Kjell |
|
Back to top |
|
 |
Tibor |
Posted: Tue Nov 18, 2003 4:45 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Kjell, look a code snippet for example: (an IDOC splitting)
Code: |
SET OutputRoot.Properties = InputRoot.Properties;
SET OutputRoot.MQMD = InputRoot.MQMD;
SET OutputRoot.MQMD.Version = MQMD_VERSION_2;
SET OutputRoot.MQMD.CorrelId = corid;
SET OutputRoot.MQMD.GroupId = corid;
SET OutputRoot.MQMD.MsgSeqNumber = sqn;
SET OutputRoot.MQMD.MsgFlags = CASE
WHEN pos + seg < mlen then MQMF_MSG_IN_GROUP
WHEN sqn = 1 then MQMF_NONE
ELSE MQMF_MSG_IN_GROUP + MQMF_LAST_MSG_IN_GROUP
END;
SET OutputRoot.BLOB.BLOB =
SUBSTRING(InputRoot.BLOB.BLOB FROM 1 FOR 524) ||
SUBSTRING(InputRoot.BLOB.BLOB FROM 525 + pos*1063 FOR seg*1063);
PROPAGATE;
|
More notes:
- Root.MQMD has an element 'GroupId' not 'MsgGroupId'
- if your message version is MQMD_VERSION_1 you have to set MQMD_VERSION_2 |
|
Back to top |
|
 |
Kjell |
Posted: Wed Nov 19, 2003 5:59 am Post subject: |
|
|
Acolyte
Joined: 26 Feb 2002 Posts: 73
|
and how is corid populated in the first place? |
|
Back to top |
|
 |
Tibor |
Posted: Wed Nov 19, 2003 4:58 pm Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Kjell wrote: |
and how is corid populated in the first place? |
This is a BLOB (MQBYTE24) variable, similar to CorrelId or MsgId.
Code: |
DECLARE corid BLOB;
SET corid=InputRoot.MQMD.CorrelId; |
|
|
Back to top |
|
 |
|