You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by konura <ab...@bluecatnetworks.com> on 2011/01/21 20:50:52 UTC

Consume specific message from queue

Hello everybody!
Is there any way to consume a specific message from the queue?

I have a code (in Java) which creates a QueueBrowser and I can see what's in
queue.
I  would like to test the content of the message and delete it if necessary.

I also came across MessageServlet, but I could not figure out how to
construct the URL in order to consume a specific message with certain
content.

Please help.
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Consume-specific-message-from-queue-tp3230481p3230481.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Consume specific message from queue

Posted by konura <ab...@bluecatnetworks.com>.
Finally, I found quite a simple solution.
It's creating a Q consumer with selector, just like this

MessageConsumer consumer = sess.createConsumer(destination, selector, true);
ActiveMQObjectMessage objMsg = (ActiveMQObjectMessage)
consumer.receiveNoWait();

where selector is an SQL-style string:   prope1='val1' AND prop2='val2'


Anyway, it would be nice to know how to construct a URL for MessageServlet.
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Consume-specific-message-from-queue-tp3230481p3234383.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Consume specific message from queue

Posted by konura <ab...@bluecatnetworks.com>.

joe_fernandez wrote:
> 
> What about a message selector?
> 
> http://activemq.apache.org/selectors.html
> 
> 
> 
Thank you,

but do you have a Java code example or

example of URL for MessageServlet ?
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Consume-specific-message-from-queue-tp3230481p3230502.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Consume specific message from queue

Posted by joe_fernandez <jo...@ttmsolutions.com>.
What about a message selector?

http://activemq.apache.org/selectors.html



-----
Joe
http://www.ttmsolutions.com/
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/Consume-specific-message-from-queue-tp3230481p3230491.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.