You must not rely on receiveNoWait to always return a message. What the
method does is check whether any messages have been dispatched to the
consumer AND are *waiting on the consumer's prefetch* This is not the case
in your test above as it takes a few cycles for the broker to dispatch over
your n
please run following test:
*package com.conceptwave.servicedesigner;
import java.util.Hashtable;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import java
Put together a unit test that shows this and we will take a look.
On Thursday, September 26, 2013, zbc wrote:
> Thanks, but i put a message in the queue, i can see it in the console,
> then i
> run the code repeatedly, but it still there, in fact, i have been
> retrieving
> if for 1 week, i don't
Thanks, but i put a message in the queue, i can see it in the console, then i
run the code repeatedly, but it still there, in fact, i have been retrieving
if for 1 week, i don't believe the broke need a couple of week to dispatch
it!!
--
View this message in context:
http://activemq.2283324.n4.
This is not a bug.
>From the JMS API doc:
http://docs.oracle.com/javaee/1.4/api/javax/jms/MessageConsumer.html#receiveNoWait()
"Receives the next message if one is immediately available."
Could be the broker hasn't dispatched the message yet, or it's in flight,
etc, etc. so it's not "immediately