Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
5.2.0
-
None
Description
We have registered a durable topic consumer using org.springframework.jms.listener.DefaultMessageListenerContainer. When the server is shut down or becomes unavailable we would like the consumer to be notified in some way.
Currently there is an exception logged in activemq on level debug but the consumer is not aware that the server is no longer available. Is it possible to propogate this exception back through spring or register somehwere in activeMQ to capture this 'server unavailable' event?
Client is linux activemq 5.2, spring 2.5. Server is linux activemq 5.3
Here is the client log when the server is stopped.
2010-03-02 17:07:31,063 [taskExecutor-1] DEBUG 2010-03-02 17:07:32,063 [taskExecutor-1] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Consumer [ActiveMQMessageConsumer
{ value=ID:lab-1-33000-1267511832426-0:2:1:1, started=true }] of session [PooledSession { ActiveMQSession
{id=ID:lab-1-33000-1267511832426-0:2:1,started=true} }] did not receive a message
2010-03-02 17:07:32,704 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException
java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:375)
at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185)
at java.lang.Thread.run(Thread.java:619)
2010-03-02 17:07:32,706 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616
2010-03-02 17:07:33,063 [taskExecutor-1] DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Consumer [ActiveMQMessageConsumer
] of session [PooledSession { ActiveMQSession
{id=ID:lab-1-33000-1267511832426-0:2:1,started=true} }] did not receive a message
etc. . .
Spring durable topic registration
<jms:listener-container connection-factory="jmsFactory"
task-executor="taskExecutor"
acknowledge="transacted"
destination-type="durableTopic"
client-id="DLT">
<jms:listener destination="logTopic" ref="listener" subscription="durableLogTopic" />
</jms:listener-container>
------
Don't think there is an easy way. You need to set a
ClientInternalExceptionListener on the underlying activemq connection, but
there is no easy way to set that via spring as there is no access to the
connection.
One option would be to provide your own connection factory that can wrap and
delegate to the acivemq connectionfactory and set a
clientInternalExceptionListener on each returned connection.
From the implementation of the listener you can do what ever you need.
Shared instances of transport and exception listeners are already exposed on
the connection factory, I think it would make sense to also add a shared
clientInternalExceptionListener option also.
Could you open a jira issue to track this?