users@glassfish.java.net

Re: jms bug in glassfish? (for synchronous consumption)

From: <glassfish_at_javadesktop.org>
Date: Thu, 24 Jan 2008 06:00:34 PST

It's [i]maybe[/i] related to the transactional behavior (I'm not sure to have understood your problem correctly).

"What actually happens (speculating here) is that the receive blocks before the send finishes. Then after the receive's timeout occurs, the block is released and the send occurs after the receive. The standalone client receives the message but it's too late, the web service has already returned with null as the reply."

 The webservice is implicitely running with transactional mode @REQUIRED. In this case, the parameters in the call to "connection.createSession(false, Session.AUTO_ACKNOWLEDGE);" are not taken into consideration. The session is transactionnal and will be committed by the application server. This means that the message is sent only at the end of the web method. It's maybe not the same behavior as with a database, where you can insert data and read them again immediately if you're in the same transaction.

In the stand alone client, the session has not the same transactional behaviour, and the message is really sent after "producer.send(...)".

You could maybe try to use bean-managed transaction and use one transaction to send the message and one to retrieve the result.
[Message sent by forum member 'ewernli' (ewernli)]

http://forums.java.net/jive/thread.jspa?messageID=255592