Author |
Message
|
kun.leeing |
Posted: Sun Jun 14, 2009 8:21 pm Post subject: QueueBrowser receive message from the queue |
|
|
 Disciple
Joined: 27 Sep 2008 Posts: 171
|
Hi, experts.
How can I receive (remove) the message from the queue that my queuebrowser looking at.
I used iterator to traverse the messages on that queue.And what I want is When I find the message I'm waiting , I can receive(remove) it indeed from the queue. At other times, I'm just using 'getEnumeration' by queuebrowser at intervals.
But Now My QueueBrowser just can browse the messages by hasNext() and getNext(). How can I receive(remove) the one as it be found?
Thanks in advance. |
|
Back to top |
|
 |
Mr Butcher |
Posted: Sun Jun 14, 2009 10:16 pm Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
don't know much about "your queuebrowser", but getting a message i just browsed is a task for "getmessageundercursor" - option. have a look at the APR guide.
there are lots of free queue utilities (including browse and remove functions) available, maybe you should use one of those instead of writing a new one. search here for utilities. _________________ Regards, Butcher |
|
Back to top |
|
 |
kun.leeing |
Posted: Mon Jun 15, 2009 12:10 am Post subject: |
|
|
 Disciple
Joined: 27 Sep 2008 Posts: 171
|
Thanks, Mr Butcher.
But what's the APR ?
And yes, the "getmessageundercursor" is really what I want.And Can it be used to receive messages from the queue being browsed? |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jun 15, 2009 12:28 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kun.leeing wrote: |
But what's the APR ? |
Application Programming Reference - part of the documentation, you'll find it in the usual places.
kun.leeing wrote: |
Can it be used to receive messages from the queue being browsed? |
It's the only way it can be used; the non-browse read has no concept of cursor.
Also bear in mind that a cursor in WMQ is as expensive (resource wise) as a database cursor and should be avoided if possible.
I share the concern of my associate you're reinventing a wheel here. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kun.leeing |
Posted: Mon Jun 15, 2009 2:24 am Post subject: |
|
|
 Disciple
Joined: 27 Sep 2008 Posts: 171
|
Thanks,vitor.
But Can this (message browsing based on Cursor) be used by JMS API?
Though APR gives the MQI method for it, I don't know how to do it by JMS.
And my target is to process reply messages by manual(by my app).
So I should determine which message that have been sent get a reply, and remove it from the original queue.
If I don't use queuebrowser , How can I implement this? |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jun 15, 2009 2:42 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kun.leeing wrote: |
But Can this (message browsing based on Cursor) be used by JMS API? |
I'll leave that question to a Java person!
kun.leeing wrote: |
And my target is to process reply messages by manual(by my app).
So I should determine which message that have been sent get a reply, and remove it from the original queue.
If I don't use queuebrowser , How can I implement this? |
I don't understand your requirement there (my bad). Are you writing some kind of manual clean-up tool? Why would a request message that has been sent a reply still be on any queue? Why not fix the underlying causes of any problems rather than develop a tool? Or use a support pac?
If you could rephrase your explaination please, my penny might drop. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 15, 2009 7:34 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
kun.leeing..
I do that the following way: Once you know which message you want to receive / delete create a selector with this message's msgid (remember to use provider native form) and receive the message with the selector.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kun.leeing |
Posted: Tue Jun 16, 2009 7:01 am Post subject: |
|
|
 Disciple
Joined: 27 Sep 2008 Posts: 171
|
Thanks, saper and vitor.
And do I must change selector dynamically and ceaselessly if I used the message' msgid associated. If so, what about the performance and how can I do this? I can create consumer using the method 'session.createConsumer' with a param as selector.But how can I change it at runtime?
And plus, what's the 'provider native form' (bingding mode)? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jun 16, 2009 7:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
I'm afraid that still doesn't explain your requirement to me.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kun.leeing |
Posted: Tue Jun 16, 2009 7:56 am Post subject: |
|
|
 Disciple
Joined: 27 Sep 2008 Posts: 171
|
Hi, vitor.
It's my false that can not explain my problem clearly.
I have two queues .One is for receiving message from a topic and retransmit it to a remote queue directed to a far end. Another saves a copy of this message and check the reply to redeliver. The message on this queue do not get a match one should be sent again.
So I want to use Queuebrowser to check and cursor to operate when needed. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Tue Jun 16, 2009 8:02 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
This sounds horrible..... Whats to stop the queue that stores requests from getting large? Doing a full scan of this queue could be expensive.
Is it not possible to store the "sent" indicator in a DB table based on an index? at least this will peform better. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jun 16, 2009 9:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kun.leeing wrote: |
Another saves a copy of this message and check the reply to redeliver. |
So you don't trust WMQ's assured deliver facilities then? Why not use the facilities built in? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jun 16, 2009 9:21 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
WMBDEV1 wrote: |
This sounds horrible..... |
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|