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 » Message Order in a Q

Post new topic  Reply to topic
 Message Order in a Q « View previous topic :: View next topic » 
Author Message
Ajju.
PostPosted: Wed Oct 30, 2002 2:54 pm    Post subject: Message Order in a Q Reply with quote

Voyager

Joined: 26 Jul 2002
Posts: 77

How do we get a message from a queue which is lined up in a queue at 3rd position with queue having 5 messages in it.

the get is through java program and this is a return message with correlation ID.
the java program has the message ID which is now the correlation ID in the message.

when i do the get on the queue i dont get any message as the message what i want is at no3. and there are 2 more messages before it.

so in this scenario how can i get my message without touching the first 2 messages and get the third message...... something like picking up only that message which i want and not following the order of messages in the queue.


Thanks,
Ajit.
Back to top
View user's profile Send private message
mgrabinski
PostPosted: Thu Oct 31, 2002 3:20 am    Post subject: Reply with quote

Master

Joined: 16 Oct 2001
Posts: 246
Location: Katowice, Poland

You said you didn't get any message/ It's not because your message is 3rd, it's because there are no messages matching your CorrelId

When MQGETting messages with specified MsgId and CorrelID, you will always get the first message that matches your criteria.
_________________
Marcin Grabinski <><
Back to top
View user's profile Send private message
mqonnet
PostPosted: Thu Oct 31, 2002 7:37 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

Ajit,

When you issue an MQGET with correlid or rather any such key, MQ scans through all the messages on the queue to find the appropriate one and picks the one that matches. That does not mean you have touched/modified the others that it scanned for a match. It is not like you picked up or retrieved the first 2 messages when you knew that they were not the ones your app wishes to get. What mq does under the layers should not bother you or your app. Your app retrieves the message that you requested for at all times.

Cheers.
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PeterPotkay
PostPosted: Thu Oct 31, 2002 8:39 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

It does touch/modify a message on it's search for the one you really want in that if a message is expired, that is when it actually gets removed.

If you had 5 messages on a queue, and the 1st 2 were expired, the 3rd was the one you wanted (it had a correl ID of "MyMessage" and was not expired) and the last 2 were expired, you would see the following.

Queue Depth is 5.
You do a get specifying correl ID "MyMessage". The QM looks at the 1st message, sees that its expired (doesn't even bother looking at its correl ID), and discards it. It does the same for the second message. It looks at the 3rd message, sees that the Correl ID matches, sees that it is unexpired and committed, and gives it back to you. It doesn't touch messages 4 or 5.
Queue depth is now 2 (both expired messages (#4 & #5)) and you have your message.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
Ajju.
PostPosted: Fri Nov 01, 2002 5:34 am    Post subject: Reply with quote

Voyager

Joined: 26 Jul 2002
Posts: 77

I read it in some IBM documentation for mqseries that the messages are in FIFO order. so now if messages are in FIFO order then how will my appication work which picks up messages in random order.

that is if application 1-5 puts different messages in one RequestQ..... this get processed at remote message server, assigns the respective message ID to correlationID and puts back in ResponseQ.

at the ResponseQ end i guess all messages are in FIFO order and now if appication 3 wants to pick its msgID-CorrID matching message which is at suppose 3rd postion in the ResponeQ... will it has to wait for first 2 messages to get cleared off the Q... considering the first 2 application are not ready to pick up its message at this time and the 3rd appiaction is in realtime and sync. way.

Thanks,
Ajit
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Nov 01, 2002 9:10 am    Post subject: Reply with quote

Jedi Knight

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

I'm not sure that the order of the messages on the queue really has to matter to you. You can specify various options when you are getting a message:

    MsgId
    CorrelId
    GroupId
    MsgSeqnumber
    Offset

This will allow you to get a particular message regardless of where it may be on the queue (ie, you can skip over message 1 and 2 to get 3). There are details in the Application Programming Reference in both the discussion of the MQMD and the MQGMO.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
mqonnet
PostPosted: Fri Nov 01, 2002 10:32 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

If you have 5 messages on the queue and the 3rd message on the queue satsifies the criterion that your app is requesting for. Then ONLY the 3rd message be picked up. The app does not wait for the other 2 ahead of this 3rd message to be picked up first. Even though MQ follows Fifo. It is followed on a PUT. And need not necessarily be followed on a get, as you have "keys" with which you could filter out the results that you want out of the queue.

Hence you have to not take the literal sense of FIFO on a get in mq.

So, the underlying message is, the app retrieves that message which satisfies the condition(msg id /correl id etc). It does not care if there are any other messages on the queue which were put ahead of it that do not satisfy the critera.

Hope this helps.

Cheers.
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » Message Order in a Q
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.