Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Selectively pulling messages off of a JMS Queue in Spring

Posted on 2008-06-18
5
Medium Priority
?
988 Views
Last Modified: 2013-11-15
I am using Spring to interface with an asynchronous JMS queue. The Spring listeners that I have created pull all of the messages off of the queue as soon as they are placed there. I am trying to figure out how to find a particular message then retrieve it manually. I want the messages to sit on the queue then when I am ready I want to find a particular message then retrieve it. Does anyone know how to do this?    
0
Comment
Question by:texastemplar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 1500 total points
ID: 21820241
If you are retrieving the messages using the receive() method I am afraid you will have to read them before you can decide if the messages are the ones you want. Maybe the API you ar using has methods to do what you ask for but I can't think of any solution using the standard JMS APIs.
0
 

Author Comment

by:texastemplar
ID: 21824210
What about JMSTemplate.receiveSelected(String messageSelector) method? According to the docs Ive read I can provide a string that will determine which messages this listener will receive. Im thinking about using the jmsmessageid header to pull the messages.

ex.  receiveSelected("jmsmessageid = 1234")
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 1500 total points
ID: 21853794
You can use this but this reads messages synchronously. It will block the queue until the message becomes available (or timeout has expired).
0
 

Author Comment

by:texastemplar
ID: 21868363
I figured it out. I added properties ( using message.setStringProperty() ) to each message that enables me to uniquely identify each message. Then I used receiveSelected( "property = value" ) to retrieve the message.
0
 

Author Comment

by:texastemplar
ID: 21878071
ok
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
Invest in your employees with these five simple steps to improve employee engagement and retention.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question