Browsing JMS messages using selector

Requirement

I want to browse for messages, using a selector.

SENDER

I'm sending messages in my Queue, with a property PARAMETER_ID set in it as.

message.setStringProperty("PARAMETER_ID",param_id);

Assume there are 4 messages sent in my Queue.

1. Text=Message1,PARAMETER_ID=1233

2. Text=Message2,PARAMETER_ID=4566

3. Text=Message3,PARAMETER_ID=1233

4. Text=Message4,PARAMETER_ID=4566

RECEIVER

--

I want to browse messages that have a certain PARAMETER_ID property set in it.

So here's what I'll do.

String myselector = "PARAMETER_ID=1233";

QueueBrowser qb=session.createBrowser(queue,myselector );

The QueueBrowser instance returned, should have 2 messages in it, that can be browsed.

But I dont get any results and there's no exception.

What am I doing wrong?

btw - If I set the myselector to "", it returns me all 4 messages to browse.

I'm using JBOSS with JMS 1.1

Thanks

[1013 byte] By [aphatarphekara] at [2007-11-27 6:11:14]
# 1
Have you tried "PARAMETER_ID='1233'" ?
one9966a at 2007-7-12 17:17:25 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
Awesome !! The single quote worked. Thanks a lot.
aphatarphekara at 2007-7-12 17:17:25 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

Hi,

I cannt understand ..this

Assume there are 4 messages sent in my Queue.

1. Text=Message1,PARAMETER_ID=1233

2. Text=Message2,PARAMETER_ID=4566

3. Text=Message3,PARAMETER_ID=1233

4. Text=Message4,PARAMETER_ID=4566

What is this ? is this msg in queue? what is PARAMETER_ID?

becaz my msg contains..

org.jboss.mq.SpyTextMessage {

Header {

jmsDestination : QUEUE.TMSQueueRemote

jmsDeliveryMode : 2

jmsExpiration: 0

jmsPriority: 4

jmsMessageID: ID:6-11824034000315

jmsTimeStamp: 1182403400031

jmsCorrelationID: null

jmsReplyTo: null

jmsType : null

jmsRedelivered : true

jmsProperties: {JMS_JBOSS_REDELIVERY_COUNT=1}

jmsPropertiesReadWrite:false

msgReadOnly: true

producerClientId: ID:6

}

Body {

TEsf

}

}

Thilsena at 2007-7-12 17:17:25 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...