|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQGET Correlated Read |
« View previous topic :: View next topic » |
Author |
Message
|
BrendanCarson |
Posted: Thu Oct 20, 2005 1:06 pm Post subject: MQGET Correlated Read |
|
|
Newbie
Joined: 20 Oct 2005 Posts: 2
|
Step 1.
I read a message and put the Msg Id in a database. Put the message on a Pending Queue.
Step 2.
I read the Msg Id From the database into a char*.
I do a MqGet passing in the Msg Id from the database.
I am unable to find the Message usnig the MSG ID stored in the Database.
Any Help Would be appreciated. |
|
Back to top |
|
 |
jasonJonas |
Posted: Thu Oct 20, 2005 2:14 pm Post subject: |
|
|
Novice
Joined: 07 Sep 2005 Posts: 10
|
what api are you using? i'm only familiar with the .net api, but this may shed some light on your issue....
when dealing with message id's, i use the hex version of the id. for instance, as a parameter value in a url which is roughly equivalent to your scenario.
on a side note... if you are using the .net api, MQMessage.MessageIdHex does *not* zero-pad hex byte values less than 9. i wrote my own util to convert the byte array to a hex string. i'm sure it's not the most elegant, but then i'm a java-man and this works. here's the important part:
Code: |
For i As Integer = 0 To mqMessage.MessageId.Length - 1
meta.messageId &= Right("00" & Hex$(mqMessage.MessageId(i)), 2)
Next i
|
back on track...
when getting the message be sure and set the MQMO_MATCH_MSG_ID option in the MQGetMessageOptions.Options property and, of course, set the MQMessage.MessageIdHex property to your saved message id. here's the pertinent snippet:
Code: |
Dim mqMessage As MQMessage
Dim mqOptions As MQGetMessageOptions = mqSession.AccessGetMessageOptions()
mqOptions.Options += MQGMO_NO_WAIT + MQMO_MATCH_MSG_ID
mqMessage = mqSession.AccessMessage()
mqMessage.MessageIdHex = metaMessage.messageId
mqQueue.Get(mqMessage, mqOptions)
|
metaMessage is an instance of a class i use to hold message meta data (e.g. message id, correlation id, etc.).
hope some of that helps.
jason |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Oct 21, 2005 3:07 am Post subject: Re: MQGET Correlated Read |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
BrendanCarson wrote: |
I read the Msg Id From the database into a char*. |
Are you sure this is the right thing to read it as?
Are you sure you are storing it in the database correctly in the first place?
Byte Array to Hex in and then Hex to Byte Array out is a reasonably good way to solve this problem.
Byte array in and then into Byte Array out is maybe better. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
BrendanCarson |
Posted: Fri Oct 21, 2005 7:30 am Post subject: Suppling a MSGID to MQGET |
|
|
Newbie
Joined: 20 Oct 2005 Posts: 2
|
Hi Jeff,
I do the follownig to store the msgid[24] in the database. Converting the MsgId to Hex one byte at a time. Do you have a suggestion on how to store the MsgId in the database.
for (i = 0 ; i < 24 ; i++)
{
sprintf(lTmpBuf,"%02X",pMd.MsgId[i] );
strcat(lMsgId, lTmpBuf);
}
Also, Do you have a suggestion on how to retreive it out of the database and convert back to MQBYTE24? |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|