It's not a secret anymore!
The moose likes EJB and other Java EE Technologies and the fly likes JMS Message Filtering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS Message Filtering" Watch "JMS Message Filtering" New topic

JMS Message Filtering

Sayed AI

Joined: Mar 06, 2006
Posts: 1
I'm new to JMS.I've to implement JMS in my project.
I followed so many docs regarding Message Filteration but couldnt solve my problem.

Pls guide or suggest me to the sol.
Here 's my requirement:
Sending a msg with client id and receiving the msg with that client id.Looks very simple.But the problem is where to use the filteration mechanism.I set the message msg.setStringProperty("User", user); and while receiving msg.getStringProperty(User);.It works aslo fine.If i proceed in this way to read a specific msg i've to scan all the messages in the queue.
what kind of messaging is best suitable here pls suggest and guide .My requirement is I dont need to scan all the messsages to get my required msg.
Thanx for early answer.
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

The requirement you state, can be met by using "Message Selectors". Have a look at:

[My Blog] [JavaRanch Journal]
Pranav Shukla
Ranch Hand

Joined: Oct 05, 2005
Posts: 64

You can specify the messageSelector while creating your QueueReceiver.


MessageSelector string is a SQL like query language where you specify the filtering criteria.

Pranav Shukla
I agree. Here's the link:
subject: JMS Message Filtering
It's not a secret anymore!