]
Tim Fox commented on JBMESSAGING-1140:
--------------------------------------
This is not a bug.
If you send a message to an empty queue and immediately call receiveNoWait() there is no
guarantee you will receive that message.
According to the JMS spec it should "Receives the next message if one is immediately
available.".
Just because you sent the message doesn't mean it's immediately available, there
can be several reasons for this:
1) Non persistent messages are sent asynchronously to the server, so they'll possibly
arrive sometime after the call to send() has returned.
2) JBM retrieves messages from a client side buffer. So the message needs to get from
client->server. then from server->client buffer which is also asynchronous.
You'll find pretty much any messaging system (with the exception of JBoss MQ) works
this way.
Having to make all message sends synchronous, and receiveNoWait to synchronously query the
server each time would cripple performance and is not necessary anyway.
QueueReceiver starts out of sync with the server, so receiveNoWait
always returns null
--------------------------------------------------------------------------------------
Key: JBMESSAGING-1140
URL:
http://jira.jboss.com/jira/browse/JBMESSAGING-1140
Project: JBoss Messaging
Issue Type: Bug
Components: JMS Client Manager
Affects Versions: 1.4.0.SP1
Reporter: Carlo de Wolf
Assigned To: Tim Fox
When there is a single message on the queue the browser will correctly report 1 message,
but the receiver will not receive it right away.
QueueBrowser browser = session.createBrowser(queue);
Enumeration e = browser.getEnumeration();
List messages = CollectionsUtil.list(e);
QueueReceiver receiver = session.createReceiver(queue);
message = (TextMessage) receiver.receiveNoWait();
2007-11-06 13:58:06,437 TRACE [org.jboss.jms.client.JBossSession] attempting to create
consumer for destination:JBossQueue[DLQ]
2007-11-06 13:58:06,438 TRACE [org.jboss.jms.client.delegate.DelegateSupport]
SessionDelegate[1802245312, ID=c8a-r0sgfo8f-1-hnjqbo8f-ilci1t-110j3] invoking
org.jboss.jms.wireformat.SessionCreateConsumerDelegateRequest@2e7857a5 synchronously on
server using Client[838449156]
2007-11-06 13:58:06,480 TRACE [org.jboss.jms.client.delegate.DelegateSupport]
SessionDelegate[1802245312, ID=c8a-r0sgfo8f-1-hnjqbo8f-ilci1t-110j3] got server response
for org.jboss.jms.wireformat.SessionCreateConsumerDelegateRequest@2e7857a5:
org.jboss.jms.wireformat.SessionCreateConsumerDelegateResponse@1d30b5e2
2007-11-06 13:58:06,484 TRACE [org.jboss.jms.client.delegate.DelegateSupport]
ConsumerDelegate[1910585900, ID=j8a-itsgfo8f-1-hnjqbo8f-ilci1t-110j3] invoking
org.jboss.jms.wireformat.ConsumerChangeRateRequest@79b2591c synchronously on server using
Client[838449156]
2007-11-06 13:58:06,486 TRACE [org.jboss.jms.client.delegate.DelegateSupport]
ConsumerDelegate[1910585900, ID=j8a-itsgfo8f-1-hnjqbo8f-ilci1t-110j3] got server response
for org.jboss.jms.wireformat.ConsumerChangeRateRequest@79b2591c:
org.jboss.jms.wireformat.NullResponse@468034b6
2007-11-06 13:58:06,488 TRACE [org.jboss.jms.client.container.ClientConsumer]
ClientConsumer[j8a-itsgfo8f-1-hnjqbo8f-ilci1t-110j3] receiving, timeout = -1
2007-11-06 13:58:06,488 TRACE [org.jboss.jms.client.container.ClientConsumer]
ClientConsumer[j8a-itsgfo8f-1-hnjqbo8f-ilci1t-110j3]: receive, noWait
2007-11-06 13:58:06,488 TRACE [org.jboss.jms.client.container.ClientConsumer]
ClientConsumer[j8a-itsgfo8f-1-hnjqbo8f-ilci1t-110j3]: no message available
2007-11-06 13:58:06,545 TRACE [org.jboss.jms.client.container.ClientConsumer]
org.jboss.jms.client.container.ClientConsumer$HandleMessageRunnable@66201d6d receiving
message delegator->JBossMessage[58368]:PERSISTENT, deliveryId=1 from the remoting
layer
2007-11-06 13:58:06,545 TRACE [org.jboss.jms.client.container.ClientConsumer]
org.jboss.jms.client.container.ClientConsumer$HandleMessageRunnable@66201d6d added
message(s) to the buffer are now 1 messages
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: