Bugs item #429185, was updated on 2001-05-31 16:42
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=429185&group_id=22866

Category: JBossMQ
Group: v2.2.1 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Watkins (robertdw)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problem with receiving and sending.

Initial Comment:
I've moved on from the last bug (by making the thread 
transient), and now I've got this problem.

Here's my scenario:

I have a JMS listener happily listening away for 
messages on a queue. A bit to the side, I have a JMS 
client, running inside the same JVM.

The client sends messages to the listener, and waits 
for a reply on the temporary queue. (See my last 
problem for the code, if you want). The listener gets 
the message, processes it, and sends a reply. The 
following sequences of events then occur:

The ClientConsumer for the temporary queue (ID2 in the 
trace below) performs scanExclusiveQueue(). This 
detects the message in the queue, removes it and 
places it in an internal queue, sets the 
Subscription.receiving to false, and then notifies 
that there's a message available.

The ConnectionReceiver (an RMI one, in this case) 
wakes up, and tells it's SpyConnection to deliver the 
message. The SpyConnection then calls addMessage() on 
it's SpyMessageConsumer. SpyMessageConsumer.addMessage
() retrieves it's subscription, and calls accept() on 
it. This fails, because the subscription is no longer 
receiving!

Here's a trace file snippet of the process, as of the 
reply message being sent. (I added and modified some 
of the trace to be sure of what was going on).

[JBossMQ] ExclusiveQueue->run()
[JBossMQ] ClientConsumer:ID2->scanExclusiveQueue
(queue=ExclusiveQueue)
[JBossMQ] Checking Subscription.accepts() 
[org.jbossmq.Subscription@27f79d (-2147483648)]
[JBossMQ] [Subscription 
org.jbossmq.Subscription@27f79d (-2147483648)] 
receiving set to 'false'
[JBossMQ] ClientConsumer:ID2->notifyMessageAvailable()
[JBossMQ] ClientConsumer:ID2->run()
[JBossMQ] ConnectionReceiver: Receive(ReceiveRequest
[1])
[JBossMQ] Checking Subscription.accepts() 
[org.jbossmq.Subscription@27f79d (-2147483648)]
[JBossMQ] Selector failed. Queue has no listener and 
is not receiving.
[JBossMQ] listening=false,      receiving=false
[JBossMQ] WARNING: NACK issued. The subscription 
org.jbossmq.Subscription@27f79d (-2147483648) did not 
accept the message


The problem occurs because both the ClientConsumer and 
the SpyMessageConsumer have the same Subscription 
instance (probably because it's in the same JVM), as 
demonstrated by the object IDs in the trace.

I've worked around this in my code by stopping the 
ClientConsumer setting Subscription.receiving to 
false. However, this would probably fail in a 
distributed mode. Any suggestions?

[The source code I'm using is the nightly snapshot 
from 28 or 29 May, 2001]

Robert.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=429185&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to