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 » IBM MQ Java / JMS » QueueBrowser receive message from the queue

Post new topic  Reply to topic
 QueueBrowser receive message from the queue « View previous topic :: View next topic » 
Author Message
kun.leeing
PostPosted: Sun Jun 14, 2009 8:21 pm    Post subject: QueueBrowser receive message from the queue Reply with quote

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
View user's profile Send private message Send e-mail
Mr Butcher
PostPosted: Sun Jun 14, 2009 10:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
kun.leeing
PostPosted: Mon Jun 15, 2009 12:10 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Vitor
PostPosted: Mon Jun 15, 2009 12:28 am    Post subject: Reply with quote

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
View user's profile Send private message
kun.leeing
PostPosted: Mon Jun 15, 2009 2:24 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Vitor
PostPosted: Mon Jun 15, 2009 2:42 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Jun 15, 2009 7:34 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
kun.leeing
PostPosted: Tue Jun 16, 2009 7:01 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue Jun 16, 2009 7:05 am    Post subject: Reply with quote

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
View user's profile Send private message
kun.leeing
PostPosted: Tue Jun 16, 2009 7:56 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
WMBDEV1
PostPosted: Tue Jun 16, 2009 8:02 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Jun 16, 2009 9:20 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Jun 16, 2009 9:21 am    Post subject: Reply with quote

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
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 » IBM MQ Java / JMS » QueueBrowser receive message from the queue
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.