ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API SupportSetting Correlation ID

Post new topicReply to topic
Setting Correlation ID View previous topic :: View next topic
Author Message
DerLexus
PostPosted: Tue Mar 11, 2014 3:32 am Post subject: Setting Correlation ID Reply with quote

Newbie

Joined: 11 Mar 2014
Posts: 5

Hello,

im writing a gateway from Dynamics AX to Websphere MQ using the .net classes.

The gateway should replace another one and the message that i sent must be identical to the old one. The messages i sent are nearly identical but one thing is different.

I have to set the correlation id manually, i do this using the MQMessage.setCorrelationId function. If i look at the message using MQ Explorer the correlation id is identical to the message id. But the curious thing ist that "my" correlation id seems to be appended after the copied message id.

Ive tried differen PutMessage and Message Options, but it changes nothing.

Can someone give me a hint what i have to set to trigger the use of my correlation id and not the copy of the message id?

Thank you!
Bye!

Here is the X+ code from dynamics, its quite simple (do not wonder, X++ cannot use .net constants, i have to "hard-code" them):

Code:

        // acces mqmgr
        mqQMgr = new IBM.WMQ.MQQueueManager( manName , channelName ,  connectionName);

        // access queue
        mqQueue = mqQMgr.AccessQueue( queueName, 8208 );
        // read msg content from file
        reader = new System.IO.StreamReader(fileNameImage);
        utf8 = System.Text.Encoding::get_UTF8();
        bytes = utf8.GetBytes( reader.ReadToEnd() );
        reader.Close();

        // create message and write content
        mqMsg = new IBM.WMQ.MQMessage();
        mqMsg.Write(bytes,0, bytes.get_Length());

        // set correlation id
        utf8 = System.Text.Encoding::get_UTF8();
        mqMsg.set_CorrelationId(utf8.GetBytes("ZJ0SR58700841820.TIF"));

        // send message
        mqPutMsgOpts = new IBM.WMQ.MQPutMessageOptions();
        mqQueue.Put( mqMsg, mqPutMsgOpts );
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Tue Mar 11, 2014 2:51 pm Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

What do you mean by appended? MsgId and CorrelId are both 24 byte binary fields, so if a MsgId was copied to a CorrelId it would use up all 24 bytes and there would be no space left to append anything.

When you set CorrelId make sure you set all 24 bytes, otherwise there could be random garbage on the end that would upset any attempt by a consumer app to do a match on Correlid.

Can you post a dump of the MQMD?
_________________
Glenn
Back to top
View user's profile Send private message
DerLexus
PostPosted: Tue Mar 11, 2014 11:38 pm Post subject: Reply with quote

Newbie

Joined: 11 Mar 2014
Posts: 5

Hi, thanks for your reply. Here ist the data from mq-explorer for my sent message. As you can see, the correlation id goes from 0x99 to AF (MQ Explorer shows that AMQ... as correlation id). The correlation Id that i set by code is located at B0 but not recognized as correlation id?

I would expect that my correlation id goes from B0 because that is the position for the correlation id and the original message is formated like that.

What's wrong here?

PS: Thanks for the hint with the padding, i will add that.

Code:

00000   58 51 48 20 01 00 00 00--41 5A 4B 2E 56 4B 2E 45  |XQH ....AZK.VK.E|
00010   41 56 4F 52 44 45 52 2E--52 45 51 20 20 20 20 20  |AVORDER.REQ     |
00020   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
00030   20 20 20 20 20 20 20 20--** ** ** ** ** ** ** **  |        ********|
00040   ** ** ** ** ** ** ** **--** ** ** ** 20 20 20 20  |************    |
00050   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
00060   20 20 20 20 20 20 20 20--4D 44 20 20 01 00 00 00  |        MD  ....|
00070   00 00 00 00 08 00 00 00--FF FF FF FF 00 00 00 00  |........    ....|
00080   22 02 00 00 52 03 00 00--20 20 20 20 20 20 20 20  |"...R...        |
00090   00 00 00 00 01 00 00 00--41 4D 51 20 4D 51 45 41  |........AMQ MQEA|
000A0   56 54 20 20 20 20 20 20--C7 F1 D3 52 20 19 24 02  |VT      ñËR .$.|
000B0   5A 4A 30 53 52 35 38 37--30 30 38 34 31 38 32 30  |ZJ0SR58700841820|
000C0   2E 54 49 46 00 00 00 00--00 00 00 00 20 20 20 20  |.TIF........    |
000D0   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
000E0   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
000F0   20 20 20 20 20 20 20 20--20 20 20 20 4D 51 45 41  |            MQEA|
00100   56 54 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |VT              |
00110   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
00120   20 20 20 20 20 20 20 20--20 20 20 20 ** ** ** **  |            ****|
00130   ** ** ** ** ** ** 20 20--16 01 05 15 00 00 00 93  |******  .......ô|
00140   F0 F5 EE 24 D0 D1 17 A2--FF AE 4C 41 1A 00 00 00  |.§¯$ðÐ.ó «LA....|
00150   00 00 00 00 00 00 00 0B--20 20 20 20 20 20 20 20  |.......         |
00160   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
00170   20 20 20 20 20 20 20 20--0B 00 00 00 63 73 20 41  |        ...cs A|
00180   58 5C 35 30 5C 43 6C 69--65 6E 74 5C 42 69 6E 5C  |X\50\Client\Bin\|
00190   41 78 33 32 2E 65 78 65--32 30 31 34 30 33 31 31  |Ax32.exe20140311|
001A0   31 31 30 34 35 37 38 37--20 20 20 20 49 49 2A 00  |11045787    II*.|
001B0   52 36 00 00 20 59 05 C9--8E 22 25 EF BF BD 44 7B  |R6.. Y.╔Ä"%´┐¢D{|
001C0   33 EF BF BD EF BF BD 7F--EF BF BD EF BF BD 7F 7D  |3´┐¢´┐¢.´┐¢´┐¢.}|
001D0   7F EF AF AD EF BF BD 4B--0F 5B 11 56 EF BF BD EF  |.´»¡´┐¢K.[.V´┐¢´|
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Mar 12, 2014 5:18 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

DerLexus wrote:
Hi, thanks for your reply. Here ist the data from mq-explorer for my sent message. As you can see, the correlation id goes from 0x99 to AF (MQ Explorer shows that AMQ... as correlation id). The correlation Id that i set by code is located at B0 but not recognized as correlation id?

I would expect that my correlation id goes from B0 because that is the position for the correlation id and the original message is formated like that.

What's wrong here?

PS: Thanks for the hint with the padding, i will add that.

Code:

00000   58 51 48 20 01 00 00 00--41 5A 4B 2E 56 4B 2E 45  |XQH ....AZK.VK.E|
00010   41 56 4F 52 44 45 52 2E--52 45 51 20 20 20 20 20  |AVORDER.REQ     |
00020   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
00030   20 20 20 20 20 20 20 20--** ** ** ** ** ** ** **  |        ********|
00040   ** ** ** ** ** ** ** **--** ** ** ** 20 20 20 20  |************    |
00050   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
00060   20 20 20 20 20 20 20 20--4D 44 20 20 01 00 00 00  |        MD  ....|
00070   00 00 00 00 08 00 00 00--FF FF FF FF 00 00 00 00  |........    ....|
00080   22 02 00 00 52 03 00 00--20 20 20 20 20 20 20 20  |"...R...        |
00090   00 00 00 00 01 00 00 00--41 4D 51 20 4D 51 45 41  |........AMQ MQEA|
000A0   56 54 20 20 20 20 20 20--C7 F1 D3 52 20 19 24 02  |VT      ñËR .$.|
000B0   5A 4A 30 53 52 35 38 37--30 30 38 34 31 38 32 30  |ZJ0SR58700841820|
000C0   2E 54 49 46 00 00 00 00--00 00 00 00 20 20 20 20  |.TIF........    |
000D0   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
000E0   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
000F0   20 20 20 20 20 20 20 20--20 20 20 20 4D 51 45 41  |            MQEA|
00100   56 54 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |VT              |
00110   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
00120   20 20 20 20 20 20 20 20--20 20 20 20 ** ** ** **  |            ****|
00130   ** ** ** ** ** ** 20 20--16 01 05 15 00 00 00 93  |******  .......ô|
00140   F0 F5 EE 24 D0 D1 17 A2--FF AE 4C 41 1A 00 00 00  |.§¯$ðÐ.ó «LA....|
00150   00 00 00 00 00 00 00 0B--20 20 20 20 20 20 20 20  |.......         |
00160   20 20 20 20 20 20 20 20--20 20 20 20 20 20 20 20  |                |
00170   20 20 20 20 20 20 20 20--0B 00 00 00 63 73 20 41  |        ...cs A|
00180   58 5C 35 30 5C 43 6C 69--65 6E 74 5C 42 69 6E 5C  |X\50\Client\Bin\|
00190   41 78 33 32 2E 65 78 65--32 30 31 34 30 33 31 31  |Ax32.exe20140311|
001A0   31 31 30 34 35 37 38 37--20 20 20 20 49 49 2A 00  |11045787    II*.|
001B0   52 36 00 00 20 59 05 C9--8E 22 25 EF BF BD 44 7B  |R6.. Y.╔Ä"%´┐¢D{|
001C0   33 EF BF BD EF BF BD 7F--EF BF BD EF BF BD 7F 7D  |3´┐¢´┐¢.´┐¢´┐¢.}|
001D0   7F EF AF AD EF BF BD 4B--0F 5B 11 56 EF BF BD EF  |.´»¡´┐¢K.[.V´┐¢´|

Note the first four characters of the structure 'XQH ' you posted. It is the XQH (Transmission Queue Header), and not the MQMD (Message Descriptor). Look for 'MD '.

When an application MQOPENs a QRemote definition, just before your message is MQPUT to the transmission queue, the qmgr inserts an XQH to be used for routing the message down the network. The XQH contains the name of the destination queue, and destination qmgr.

The XQH is removed by the down-stream message channel agent before the message is put to the destination (or dead-letter) queue.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Wed Mar 12, 2014 2:46 pm Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

In your hex dump of MQXQH format message data that is sitting on a transmission queue, the MQ-generated MsgId starts at x98, goes for 24 bytes, and is followeed by the CorrelId field at xB0, for 24 bytes. This looks normal to me. I suggest you study the documented layout of the MQMD structure.
_________________
Glenn
Back to top
View user's profile Send private message
DerLexus
PostPosted: Wed Mar 12, 2014 11:39 pm Post subject: Reply with quote

Newbie

Joined: 11 Mar 2014
Posts: 5

Thanks for the explanation.

In the case the message above is correct and the correl_id is ZJ0SR587... ,

why does MQ Explorer shows me the AMQ MQEA... located at 0x98 as message AND correl id??
Back to top
View user's profile Send private message
DerLexus
PostPosted: Thu Mar 13, 2014 12:50 am Post subject: Reply with quote

Newbie

Joined: 11 Mar 2014
Posts: 5

OK, seems i found it out.

If i set the MessageId (and not the CorrelId) i got a message that has the correct format.

MQ Explorer show the set MessageId as Correlation ID.

Thanks for any help!
Back to top
View user's profile Send private message
JosephGramig
PostPosted: Thu Mar 13, 2014 6:32 am Post subject: Reply with quote

Grand Master

Joined: 09 Feb 2006
Posts: 1230
Location: Gold Coast of Florida, USA

DerLexus,

IH03 RfhUtilc might be a more helpful tool for you to use. Search for that sPac and try that and browse the message.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API SupportSetting Correlation ID
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.