Solved

Selectively pulling messages off of a JMS Queue in Spring

Posted on 2008-06-18
5
974 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
  • 3
  • 2
5 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 500 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 500 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
for loop with Set 4 46
triangle challenge 4 79
countPairs challenge 7 58
count11 challenge 6 47
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now