Author |
Message
|
puvvada |
Posted: Mon May 05, 2003 2:29 pm Post subject: Problem with MsgId & CorrelId |
|
|
Apprentice
Joined: 01 Apr 2002 Posts: 27
|
Hi,
Here is the problem.
From AS400 side, we are sending messages to AIX box. On the AIX box the messages are received with the same MsgId.
To isolate the problem.
1. I stopped the channel from AS400 to AIX and placed 3 messages.
2. All the messages were in the transmit Queue.
3. I looked at the message headers and I could see different MsgId's but,
some same Correlation Id.
4. Now I start the channel and messages went through.
5. I looked at the messages on AIX side, and the MSgId for all messages
are same and the value is of the Correlation ID which I saw in step 3.
We tried the channel CONVERT attribute to YES and still the messages have the same MsgId.
I might be missing some setting parameters to correct the problem.
Thanks for your help in advance to this problem.
-Deven |
|
Back to top |
|
 |
vennela |
Posted: Mon May 05, 2003 2:38 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
That doesn't make sense but:
Is MQ setting the message id (it does by default) or are you setting it explicitly in your app
If you can- print out the messageId (maybe correlId too) of the PUT messages on AS/400 after the PUT.
OR PUT to a different local queue on AS/400 and browse the messages to find out the MessageIds and CorrelIds.
I don't think CONVERT option has got anything to do with this.
-------
Venny |
|
Back to top |
|
 |
RogerLacroix |
Posted: Mon May 05, 2003 8:56 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
I'm confused too. But since you mention convert, I will take a guess too.
When you look at the MsgIDs on the OS/400 box (EBCDIC), they look something like "AMQ blah blah blah" and then on the AIX side (ASCII) they look like "#$%#$&^!~" (samething 3 times) but you were expecting "AMQ blah blah blah".
If you check the manuals, certain fields of Message Descriptor (MQMD) are NOT translated between queue managers (regardless of the GMO option setting or Channel CONVERT option). The 3 fields that I remember off the top of my head are MsgID, CorrelID and GroupID.
It is up to the application (if required) to convert the data contained with those fields.
Most people treat these as hex data rather than character data. Therefore, as long as the hex data is unique, life is fine.
Hope that helps.
later
Roger... _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
lonestar |
Posted: Tue May 06, 2003 7:53 am Post subject: |
|
|
Newbie
Joined: 06 May 2003 Posts: 2 Location: Michigan, USA
|
I work wtih puvvada.
When we look at the messages in the AS/400 transmit queue, they all have different message ids & the same correlation id. All the messages sent in one job run have the same correlation id.
Then when we look at the messages in the AIX queue, now the correlation id has been moved to the message ids. They would like the message identifers to be different.
Is this the way it is suppose to work or is there a parameter that can be changed so it doesn't do this? |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue May 06, 2003 9:24 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Ok, let me take a stab at your message flow. The AS/400 application is sending a "request" message to a server application residing on the AIX box. The server application on AIX processes the message and sends a reply to the AS/400 application. True or False?
If true, are you looking at the request message before it is processed by the "server" application on the AIX box? My guess is that you are not.
Generally speaking, most messaging applications follow the following standard:
- When the server application (any platform) receives a request message, it saves the incoming message's MsgID.
- Performs the business process logic
- While building the reply message, the server application will store the requestor's MsgID in the "reply" message's CorrelID field.
- Send the reply message.
This way, the requesting application (in your case AS/400 box) can match up the request to an incoming reply message. Assuming that the AS/400 requesting application saved the message's MsgID after doing the MQPUT.
later
Roger... _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
lonestar |
Posted: Tue May 06, 2003 9:50 am Post subject: |
|
|
Newbie
Joined: 06 May 2003 Posts: 2 Location: Michigan, USA
|
There is no reply back to the AS/400. It's a send and forget message. The AIX application is doing something with the message id so they have to be unique. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue May 06, 2003 10:01 am Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Ok, what tool are you using to view the MsgID & CorrelID? Can you view those fields in HEX? (rather than character data). Are you using the same tool on both boxes?
If the MsgIDs were unique on the AS/400 box then they will be unique on the AIX box.
If you can, attach some screen prints of what you are looking at (note: don't screen print your whole desktop just the application - use ALT + PrintScreen button!!!!).
later
Roger... _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
PeterPotkay |
Posted: Tue May 06, 2003 10:19 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Forget the Convert option, it has nothing to do with the MSG IDs and Correl IDs.
Is the connection between the 2 boxes direct? In other words, does the AS400 Queue Manager have a direct SNDR channel to the AIX Queue Manager? Or is there some intermediate hops? I'll assume that it is direct and that you dont have any app in the middle messing things up.
How are you looking at the messages in the transmit queue? Take a look at the below browse of my XMIT queue, using AMQSBCG...
I put the message with a MSG ID starting with ABCDEF and a CorrelID starting with 123456.
Code: |
X:\>AMQSBCG POTKAY2
AMQSBCG0 - starts here
**********************
MQOPEN - 'POTKAY2'
MQGET of message number 1
****Message descriptor****
StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 546 CodedCharSetId : 437
Format : 'MQXMIT '
Priority : 0 Persistence : 0
MsgId : X'414D5120504F544B4159312020202020519CB73E20000805'
CorrelId : X'414243444546000008EB120003A94100A0F1120080C74200'
BackoutCount : 0
ReplyToQ : 'THIS_IS_MY_REPLY_QUEUE '
ReplyToQMgr : 'POTKAY1 '
** Identity Context
UserIdentifier : 'PP22503 '
AccountingToken :
X'160105150000005D11B555DA619B52FA0FEF24A921000000000000000000000B'
ApplIdentityData : ' '
** Origin Context
PutApplType : '7'
PutApplName : 'POTKAY1 '
PutDate : '20030506' PutTime : '18115035'
ApplOriginData : ' '
GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'
**** Message ****
length - 433 bytes
00000000: 5851 4820 0100 0000 4C4F 4341 4C2E 5155 'XQH ....LOCAL.QU'
00000010: 4555 4531 2020 2020 2020 2020 2020 2020 'EUE1 '
00000020: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000030: 2020 2020 2020 2020 4D59 434C 5553 5445 ' MYCLUSTE'
00000040: 5220 2020 2020 2020 2020 2020 2020 2020 'R '
00000050: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000060: 2020 2020 2020 2020 4D44 2020 0100 0000 ' MD ....'
00000070: 0000 0000 0800 0000 FFFF FFFF 0000 0000 '........    ....'
00000080: 2202 0000 B501 0000 4D51 5354 5220 2020 '"...╡...MQSTR '
00000090: 0000 0000 0000 0000 4142 4344 4546 0000 '........ABCDEF..'
000000A0: 08EB 1200 03A9 4100 A0F1 1200 80C7 4200 '.δ...⌐A.á±..Ç╟B.'
000000B0: 3132 3334 3536 0000 08EB 1200 CFA9 4100 '123456...δ..╧⌐A.'
000000C0: 4142 4344 4546 0000 0000 0000 5448 4953 'ABCDEF......THIS'
000000D0: 5F49 535F 4D59 5F52 4550 4C59 5F51 5545 '_IS_MY_REPLY_QUE'
000000E0: 5545 2020 2020 2020 2020 2020 2020 2020 'UE '
000000F0: 2020 2020 2020 2020 2020 2020 504F 544B ' POTK'
00000100: 4159 3120 2020 2020 2020 2020 2020 2020 'AY1 '
00000110: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000120: 2020 2020 2020 2020 2020 2020 5050 3232 ' PP22'
00000130: 3530 3320 2020 2020 1601 0515 0000 005D '503 .......]'
00000140: 11B5 55DA 619B 52FA 0FEF 24A9 2100 0000 '.╡U┌a¢R·.∩$⌐!...'
00000150: 0000 0000 0000 000B 2020 2020 2020 2020 '........ '
00000160: 2020 2020 2020 2020 2020 2020 2020 2020 ' '
00000170: 2020 2020 2020 2020 0B00 0000 5C57 6562 ' ....\Web'
00000180: 5370 6865 7265 204D 515C 6269 6E5C 414D 'Sphere MQ\bin\AM'
00000190: 5141 5049 2E45 5845 3230 3033 3035 3036 'QAPI.EXE20030506'
000001A0: 3138 3131 3530 3335 2020 2020 484F 5744 '18115035 HOWD'
000001B0: 59 'Y '
No more messages
MQCLOSE
MQDISC
X:\>
|
When a transmit queue is holding a message, there are really 3 headers! A new MQMD that looks ALMOST like your original, a transmit queue header (it starts with XQH in the above sample) and then your ORIGINAL MQMD. See where my real MSG ID and CorrelID are? Buried in the actual message.
The MSG ID of the original MQMD is put into the CorrelID of the new MQMD when the message is sitting on a XMIT queue. That is why you see the same "CORREL ID". I would bet that your application is putting the messages and is not cleaning out the MSG ID field after every put. It is in fact producing the messages with the same MSG ID.
Try again, but this time look into the message for the original MSG ID, and see if they are the same there. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
puvvada |
Posted: Tue May 06, 2003 1:06 pm Post subject: resolved:Problem with MsgId & CorrelId |
|
|
Apprentice
Joined: 01 Apr 2002 Posts: 27
|
Hi,
The problem is reloved.
It was nothing to do with the CONVERT option or the XMITQ message header.
The wrapper progam that puts messages into the queue, was putting messages with same MsgId. Instead of them we passed the current-time stamp and we started getting different MsgId.
Thank you all for clarifications and explanation, which did made us to look into the wrapper program.
-Deven |
|
Back to top |
|
 |
PeterPotkay |
Posted: Tue May 06, 2003 4:53 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Make sure your time stamp goes to at least the hundreth of a second, and preferably the millisecond. It is not unusual for an MQ program to be able to produce more than 1 message every 10th of a second, which could produce identical time stamps if you only go to the second or the tenth of a second.
Actually, 99.99999% of the time you are better off with letting the QM assign the message ID. It will unique every time - guaranteed. Just initialize the message ID field of the MQMD before every put, and after every put that field will contain the messageID that the Qm assigned to you.
If you need to carry some data in the MQMD for message selection criteria, consider putting it into the CorrelID instead. But the best design does not rely on this. It gets tricky if you start sending an EBCIDIC message ID or Correl ID to an ASCII system. They dont get converted. You are better off, if possible, to just have the getting app process every message it finds in its queue, and embed any special data where it belongs, in the message buffer. Again, sometimes you just have to use that Correl ID field for this purpose. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
|