Author |
Message
|
VijayGoparaju` |
Posted: Fri Sep 19, 2008 12:44 am Post subject: Getting the Before Messages from a Queue |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
Hello All,
Please don't take is serious.I have run the loop to get the next Messages but if I want the previous messages how can I get?
queueGetMessageOptions.Options = MQC.MQGMO_BROWSE_NEXT;
This is used to get the NEXT Message but how to get the Previous Message? Is there any method to get the previous message?
Please tell me,
Thanks,
Vijay. |
|
Back to top |
|
 |
Tibor |
Posted: Fri Sep 19, 2008 1:40 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Vijay, this a message queue, so you can read the 1st message at the 1st call of MQGET. Why do you want to get back if you can start on the foremost message? |
|
Back to top |
|
 |
atheek |
Posted: Fri Sep 19, 2008 1:56 am Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
I dont think there is something like "MQGMO_BROWSE_PREVIOUS".
One way how you could do this is to open the queue for browse multiple times which gives you multiple browse cursors and handle the cursors within the code as you wish. |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Sep 19, 2008 2:08 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
If you are browsing next, then you probably already browsed past the previous message. Why didn't you get it "while you were there"? What are you trying to do that involves trying to selectively get individual messages off a queue? You should look into the philosophy of processing all messages on the queue. |
|
Back to top |
|
 |
zpat |
Posted: Fri Sep 19, 2008 2:29 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
If your program saved the message id of the previous message you can easily browse that message by matching the msgid on MQGET. |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Fri Sep 19, 2008 2:37 am Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
Thank you very much for your replys, But my requirement is like that.
We can get the Depth of the Queue and run a loop backwards but as you said I think there is no method to move the cursor back, Currect?
If so there is no way to get the messages from the Queue in the reverse manner?
Thanks & Regards,
Vijay.... |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Fri Sep 19, 2008 2:57 am Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
zpat wrote: |
If your program saved the message id of the previous message you can easily browse that message by matching the msgid on MQGET. |
If my program saved the msgid also, how can we go to the previous message to compare the msgid? We have to browse the queue from the first message in that way also.....
Vijay... |
|
Back to top |
|
 |
zpat |
Posted: Fri Sep 19, 2008 4:27 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
I don't understand your logic. If you browse forward in the usual way (Browse next) you can keep a note of the previous message's unique message id.
So if you want to go backward you just get that message. If you mean how do you go back again, then you need to have stored all the message ids that you browsed.
RFHUTIL allows browse previous (I assume in this way). It's not hard. |
|
Back to top |
|
 |
PeterPotkay |
Posted: Fri Sep 19, 2008 5:10 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
VijayGoparaju` wrote: |
We can get the Depth of the Queue |
If you are designing your program to do gets based on the q depth, you are designing a faulty application.
<sigh>I'll try. If you *search* on this site this has been discussed many times on why this is a bad idea. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Sep 19, 2008 5:57 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I have no idea what function your program is attempting to fulfill. My advice would be to put yourself in a get message loop and just get all of the messages until there are no more.
What are you trying to do that requires you to:
- browse messages from the beginning of the queue
- browse messages from the end of the queue and go backwards
- get particular messages (sometimes the previous one, current one, and next one)
If you could shed some light on what you are trying to accomplish and what you've actually done, it might be quicker to get an answer. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Sep 19, 2008 1:18 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
VijayGoparaju` wrote: |
If my program saved the msgid also, how can we go to the previous message to compare the msgid? We have to browse the queue from the first message in that way also.....
Vijay... |
Something I quite don't get. Why do you need to compare the msgId?
MQ should have created the msgId automatically. It should have no hidden logic in it. If you have some kind of msg affinity and need to get the message based on order of the msgId you need to have a DB involved in the processing and can only use MQ for transport.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Sep 19, 2008 3:17 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Would now be a good time to introduce the concept of message groups and the group id?  |
|
Back to top |
|
 |
zpat |
Posted: Fri Sep 19, 2008 11:28 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
You need to read the MQ primer redbook, then the MQ application programming guide.
Once you understand the principles of MQ programming, we can help with the details.
The apparent lack of any training is a concern - approach your employer and demand it. |
|
Back to top |
|
 |
VijayGoparaju` |
Posted: Sun Sep 21, 2008 7:26 pm Post subject: |
|
|
Acolyte
Joined: 26 Aug 2008 Posts: 72
|
bower5932 wrote: |
I have no idea what function your program is attempting to fulfill. My advice would be to put yourself in a get message loop and just get all of the messages until there are no more.
What are you trying to do that requires you to:
- browse messages from the beginning of the queue
- browse messages from the end of the queue and go backwards
- get particular messages (sometimes the previous one, current one, and next one)
If you could shed some light on what you are trying to accomplish and what you've actually done, it might be quicker to get an answer. |
I am trying to browse messages from the end of the queue and go backwards.Is there any method to read the messages backwards?
Thanks,
Vijay... |
|
Back to top |
|
 |
Mr Butcher |
Posted: Sun Sep 21, 2008 10:33 pm Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
no, mq has not a "browse previous" function, there is just a "browse next".
some people suggested how you can implement it on your own (browse single messages by message / correlid).
again, why don't you start with some rtmf? _________________ Regards, Butcher |
|
Back to top |
|
 |
|