are you using receiveNoWait() in your consumer? It does not poll the broker for messages unless prefetch is 0. So either use prefetch=0 or receive(1000), which will give some time for the consumer to register and get a dispatch. With receiveNoWait, it is possible to get a null return before any messages are dispatched by the broker.
On 15 December 2010 00:32, Steve.V. <stephen.vinc...@sas.com> wrote: > > My JMS java client creates one consumer with a message selector and works > fine when receiving messages from WebSphere MQ. But seldom works when > receiving from a queue on ActiveMQ 5.3.1 and 5.4.1. Most of the time I > don't get any messages. I can consistently get it to work *IF* I am > stepping through the java code using the debugger in Eclipse and I have > "?jms.prefetchPolicy.queuePrefetch=1" added to my jndi provider URL. I only > have one consumer, so I don't think it is a flow control or maxPageSize > issue. However, given that it works when under the debugger, then it may be > something like that. > > In my test case, I put 50 messages on the queue, where every third > message should match on my selector, which compares against > JMSCorrelationID. (eg. JMSCorrelationID = '223456789ABCDEF012345622' ) > > I have seen it work a few times outside of the debugger, but it > fails most of the time. I am currently running this test case on Windows > XP, Java spec version 1.6.0_21, class version 50.0. > > I am able to use the activemq-admin command line tool to get > messages using a selector. For example: > > activemq-admin browse --amqurl tcp://localhost:61616 --msgsel " > JMSCorrelationID = '223456789ABCDEF012345622'" request > > However, my JMS compliant Java application is having trouble doing it. > Obviously my app is doing something different. If you have any ideas of > what might be causing this, please let me know. > > Thanks, > sv > > sasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasasas > Stephen Vincent > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/JMS-application-s-consumer-with-msg-selector-not-getting-messages-tp3088263p3088263.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > -- http://blog.garytully.com http://fusesource.com