On 8/18/06, peter anderson <[EMAIL PROTECTED]> wrote:
James Strachan <[EMAIL PROTECTED]> writes: > > There's not heaps to go on so a few questions. Which version are you > using? Do you create the consumers up front and reuse them for each > request? Is there a time lag between sending a message and calling > receiveNoWait()? > > Note that in ActiveMQ receiveNoWait() really and truly is that - we > don't wait a single millisecond or request-response communication with > the broker - if there is a message available it is returned without > any delay. > > Some JMS providers interpret receiveNoWait() as a 'poll the broker and > see if there is a message available and if so fetch it'. FWIW now we > have support for pull based consumption we could consider adding this > feature as an option if people want it - I suspect that might be the > behaviour you are expecting. > > As a workaround try using a timeout of 1000 or something? > James, Thanks for your prompt replay. I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I am calling the producer servlet first and then the consumer servlet.
Does the instantiation of the consumer servlet create the consumer? Once a consumer is created messages are dispatched asynchronously to it; so if you create a consumer then immediately call receiveNoWait() then its typically gonna return null.
Even if I leave a number of minutes between these events the messages are still not being found. However running them in a debugger does work which suggest receiveNoWait() is failing.
Maybe its the debugger adds enough time between the createConsumer() call and the receiveNoWait()
p.s. are there any admin tools I could use to look at messages in the queue ?
Yes... http://activemq.org/site/how-can-i-monitor-activemq.html -- James ------- http://radio.weblogs.com/0112098/
