Author |
Message
|
AndyT |
Posted: Mon Mar 13, 2006 7:44 pm Post subject: Wanting to capture the generated MQMD.MsgId |
|
|
Novice
Joined: 05 Nov 2003 Posts: 17 Location: Work
|
My flow is creating a new message and writing it to an MQOutput node. The 'New Message ID' option is checked and the id is created.
Am I able to capture the MsgId generated within the same flow? I tried connecting a Compute node to the Out terminal of the MQOutput node but the InputRoot.MQMD.MsgId does not contain the value.
Thank you |
|
Back to top |
|
 |
shalabh1976 |
Posted: Mon Mar 13, 2006 8:16 pm Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
That is how it behaves. The new message id is generated by MQ when the put opetation takes place. The message flow has no idea about this value and will not until it does a read / get of the message from the queue. _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
shalabh1976 |
Posted: Mon Mar 13, 2006 8:26 pm Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
You can output the message to another queue, use another MQInput to read the message from this queue and now in your compute node, you can see the latest MsgId. All these nodes can be in the same flow as your original flow. _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
EddieA |
Posted: Mon Mar 13, 2006 11:02 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
The message flow has no idea about this value and will not until it does a read / get of the message from the queue. |
Are you sure about that. My understanding about why an MQPUT node has an Output Terminal was specifically so you could capture the MsgID of the message that was just written.
I would throw a Trace node into the flow, after the MQOutput to verify what you can see.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Mar 13, 2006 11:14 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi guys,
I think EddieA is right....I was going through the primer for MQ and that itself speaks of something similar (if my understanding was right)
MQ Primer wrote: |
Message and/or correlation ID are used to identify a specific request or reply message. The programmer can move a value in one or both fields or have MQSeries create a unique ID for him or her. Before the programmer puts the request message in the queue he or she can save the ID(s) and use them in a subsequent get operation for the reply message. |
If MQ itself can get you the Id, before putting it into the queue then MB must be able to implement it, and I feel EddieA way might just be right on how.
Regards. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 14, 2006 6:26 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
EddieA wrote: |
Are you sure about that. My understanding about why an MQPUT node has an Output Terminal was specifically so you could capture the MsgID of the message that was just written.
I would throw a Trace node into the flow, after the MQOutput to verify what you can see. |
This is what I thought, too.
So I tried it... and didn't get the result I wanted.
I hooked up a flow as follows:
MQInput --> Trace --> MQOutput (new msgid) --> Trace
And the trace before the MQOutput node has the same MsgId as the Trace after.
This is, of course, with v6. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Tue Mar 14, 2006 6:55 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
Connecting the terminals
Connect the in terminal to the node from which outbound messages bound are routed.
Connect the out or failure terminal of this node to another node in this message flow if you want to process the message further, process errors, or send the message to an additional destination.
If you connect one of these output terminals to another node in the message flow, the LocalEnvironment associated with the message is enhanced with the following information for each destination to which the message has been put by this node:
- Queue name
- Queue manager name
- Message reply identifier (this is set to the same value as message ID)
- Message ID (from the MQMD)
- Correlation ID (from the MQMD)
These values are written in WrittenDestination within the LocalEnvironment tree structure.
If you do not connect either terminal, the LocalEnvironment tree is unchanged.
|
Just ran a test and it works as advertised:
Quote: |
(0x01000000):WrittenDestination = (
(0x01000000):MQ = (
(0x01000000):DestinationData = (
(0x03000000):queueName = 'JT_OUT'
(0x03000000):queueManagerName = ''
(0x03000000):replyIdentifier = X'414d5120544c41514d5742494431412043d6ced8208f5402'
(0x03000000):msgId = X'414d5120544c41514d5742494431412043d6ced8208f5402'
(0x03000000):correlId = X'000000000000000000000000000000000000000000000000'
) |
|
|
Back to top |
|
 |
wschutz |
Posted: Tue Mar 14, 2006 6:59 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Jeff, are you sure you clicked "New Msg ID", I just did it on v6 and get a new messages ID (and correlid too)....  _________________ -wayne |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 14, 2006 7:04 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
wschutz wrote: |
Jeff, are you sure you clicked "New Msg ID", I just did it on v6 and get a new messages ID (and correlid too)....  |
I'm sure I did.
I just didn't trace LocalEnvironment. So original poster and I both forgot to check the documentation for the MQOutput node to determine where this data would be placed - and assumed it would be in Root. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Bill.Matthews |
Posted: Tue Mar 14, 2006 8:48 am Post subject: Re: Wanting to capture the generated MQMD.MsgId |
|
|
 Master
Joined: 23 Sep 2003 Posts: 232 Location: IBM (Retired)
|
AndyT wrote: |
My flow is creating a new message and writing it to an MQOutput node. The 'New Message ID' option is checked and the id is created.
Am I able to capture the MsgId generated within the same flow? I tried connecting a Compute node to the Out terminal of the MQOutput node but the InputRoot.MQMD.MsgId does not contain the value.
Thank you |
This statement, when placed in a Compute node that is connected to the Out terminal of the MQOutput node will give you the message Id:
InputLocalEnvironment.WrittenDestination.MQ.DestinationData.msgId
Cheers
Bill _________________ Bill Matthews |
|
Back to top |
|
 |
AndyT |
Posted: Tue Mar 14, 2006 10:14 am Post subject: Re: Wanting to capture the generated MQMD.MsgId |
|
|
Novice
Joined: 05 Nov 2003 Posts: 17 Location: Work
|
Thank you all for the replies.
It is working OK and as specified in the Help for MQOutput node!
I had read the help (honest!) but for whatever reason this did not register. I think my presumption that Root would be updated must have clouded my vision. |
|
Back to top |
|
 |
|