Are you using client acknowledge?
Did you close the session? That will nack
unacknowledged messages, alternatively dropping
the connection will as well.
I'am using client acknowledge.
My application will be like a deamon. Connection and session will be closed when this application ends.
Do you lnow if there is a way to config jboss to redeliver messages without close connection or session?
will redeliver unacknowledged messages
I am facing a problem in Redelivery of Messages under the following scenario,
An application has subscribed (to receive messages form) to a "Topic" with the acknowledgment option set to as "Client Acknowledgment". This subscriber will perform some business operation and on the successful completion of the same the received message will be acknowledged. Suppose while performing the operation exception is thrown then, the message will not be acknowledged in the assumption that the message will be redelivered to the subscriber. But the message is not getting redelivered. JMS javadocs states that the JMS Provider will redeliver the message to the subscriber. The Topic i am using is non-durable and the Session and Connection created are not closed.
If the above observation is correct, then what should (configuration chages) be done to get the unacknowledged messages from the Topic?
As stated in your mail should the application call the "session.recover()" to get the unacknowledged messages ?
Why at all the application should do this, ideally JMS Provider should take care of redelivering the messages (unacknowledged) to their Subscribers ?
JBoss version is : 3.0.0
Please let me know your comments on the same.
"Client acknowledge" will only ack/nack under your control
not the JMS provider except when it nacks unacknowledged
messages at session/connection close.
If you are using a MessageListener, it is not
recommended to leak a RuntimeException from onMessage().
It is implementation specific how many times such
a message is redelivered. In JBoss's case the message
is redelivered *zero* times.
You should use:
public void onMessage(Message m)
// Do work
catch (Throwable t)
// Handle the problem:
// e.g. 1 redeliver
// e.g. 2 save the message somewhere and acknowledge
For a non-durable topic subscription, closing the
session/connection will delete the subscription so it won't be redelivered anyway.
I would recommend you upgrade, there
are lots of memory leaks in the topic processing before
jboss-3.0.4 and some good performance improvements
and bug fixes in jboss-3.0.7/jboss-3.2.x
I tried doing the way suggested by you. When any exception occurs in the MessageListener while processing the message , i called the " session.recover() ". But the call to session to recover resulted in throwing a IllegalStateException. The trace for the same is given below ,
javax.jms.IllegalStateException: The session is not transacted
2003-07-23 17:25:15,485 ERROR [STDERR] at org.jboss.mq.SpySession.rollback(SpySession.java:353)2003-07-23 17:25:15,486 ERROR [STDERR] at org.jboss.mq.SpySession.recover(SpySession.java:388)
2003-07-23 17:25:15,487 ERROR [STDERR] at example.SampleSender.onMessage(SampleSender.java:117)2003-07-23 17:25:15,487 ERROR [STDERR] at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:485)
The session for both Message Producer and Message Consumer are created with transacted attribute as "false".
JBoss version is : 3.0.0
The exception message that is given states that the session is not transacted , but according to JMS specification the acknowledgment mode is valid only for non-transacted sessions. But here it seems that with "Client_Acknowledgment" option it needs the session to be transacted !!!! . Does this not violate the JMS Specification ?
Please let me know your views in this regard.
That was a bug in jboss-3.0.0 (a typo in the code)