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 Index » General Discussion » Matching by MessageIDs

Post new topic  Reply to topic
 Matching by MessageIDs « View previous topic :: View next topic » 
Author Message
ddm
PostPosted: Tue Nov 09, 2004 7:45 pm    Post subject: Matching by MessageIDs Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

I have this code that allows the user to use the MessageID or CorrelationID when retrieving MQ messages. I can't make it to work when I use MatchByMessageID. On the other hand, it always works when I use the correlationID.

Here's the pseudo code:
mqMessage = new MQMessage();
if(matchOptions == MatchMessageOption.MATCH_BY_CORRELLATION_ID)
{mqMessage.CorrelationId = correlationID;
}
else if(matchOptions == MatchMessageOption.MATCH_BY_MESSAGE_ID)
{
mqMessage.MessageId = messageID;
}
MQGetMessageOptions mqGetMessageOptions = new MQGetMessageOptions();
mqGetMessageOptions.Options = MQC.MQGMO_WAIT;
mqGetMessageOptions.MatchOptions = matchOptions;
queue.Get(mqMessage, mqGetMessageOptions);

//---> it hangs on queue.Get when the MatchOption is MATCH_BY_MESSAGE_ID

***Edit Notes
mqMessage.MessageId = messageID; was originally mqMessage.MessageId = correlationID;
***


Last edited by ddm on Wed Nov 10, 2004 10:06 am; edited 1 time in total
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Tue Nov 09, 2004 9:45 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

Well, is there a message in the queue with a matching MsgID? Sounds like there is not.

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Wed Nov 10, 2004 3:32 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I think if you read the code you have posted, you will see the problem.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed Nov 10, 2004 6:02 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Good eyesight! I would have never spotted it if you hadn't said something, and it still took me five minutes.

For what it is worth, there are a couple of program (mqreqro, mqsrvro) out at:

http://www.developer.ibm.com/tech/sampmq.html

They also mess with report options. You might find them useful.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
ddm
PostPosted: Wed Nov 10, 2004 10:04 am    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

jefflowrey wrote:
I think if you read the code you have posted, you will see the problem.


I see what you're saying. I am assigning the variable correlationID to the MessageID property of the mqMessage.

Actually, in my actual code the correlationID is a parameter to a method where I pass it a value of either the correlationID or the messageID byte array

I apologize for the confusion. I'll edit my original post.

Anything else comes to mind why the MatchByMessageID doesn't work?

Thanks!
Back to top
View user's profile Send private message
ddm
PostPosted: Wed Nov 10, 2004 4:28 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

I already upgraded to CSD08 and still cannot make MatchByMessageID to work. What am i missing?

If you guys have sample code / getmessageoptions that I can use, I'd truly appreciate it. - Thanks!

Quote:

For what it is worth, there are a couple of program (mqreqro, mqsrvro) out at:

http://www.developer.ibm.com/tech/sampmq.html

They also mess with report options. You might find them useful.


On the above sample, (mqreqro, mqsrvro) it does not do a get using MatchByMessageID. It just gives the option to the user whether the system generates a new MessageID or not - which is included in the reply.
Back to top
View user's profile Send private message
JT
PostPosted: Wed Nov 10, 2004 4:50 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

as Roger wrote:
Well, is there a message in the queue with a matching MsgID? Sounds like there is not.

Can you confirm that there is a message(s) on the queue with the msgid(s) you expect?
Back to top
View user's profile Send private message
ddm
PostPosted: Fri Nov 12, 2004 9:22 am    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

JT wrote:
as Roger wrote:
Well, is there a message in the queue with a matching MsgID? Sounds like there is not.

Can you confirm that there is a message(s) on the queue with the msgid(s) you expect?


In my actual code, I first do a put() of the message, sleep a while then do a get(). There was no error on the put() so I am sure that there is a message out there with the same messageID. I also have an 'UNLIMITED' wait on the get.

Thanks!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Nov 12, 2004 9:57 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

ddm wrote:
In my actual code, I first do a put() of the message, sleep a while then do a get(). There was no error on the put() so I am sure that there is a message out there with the same messageID.


Except, of course, if you're in a transaction of some sort, and you haven't committed yet.

Or if you are doing the wrong things with message IDs and aren't setting them to the values you think you are setting them to.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Nov 12, 2004 10:17 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Run the amqsbcg program against the queue. It will browse the messages on the queue (if there are any) and it will dump the message id and correlation id out in hex. It might point to something that has been overlooked.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
JT
PostPosted: Fri Nov 12, 2004 10:25 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

Quote:
I can't make it to work when I use MatchByMessageID. On the other hand, it always works when I use the correlationID.

Can we assume your (message id) logic is identical to the method for retrieving by correlation id?

Is there an expiry set on the message?

What reason code are you receiving (2033)?

Quote:
In my actual code, I first do a put() of the message, sleep a while then do a get(). There was no error on the put() so I am sure that there is a message out there with the same messageID. I also have an 'UNLIMITED' wait on the get.

Why are you setting an unlimited getwait interval if you had previously written the message to the queue and then went into a delay?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » Matching by MessageIDs
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.