I am using spring jms listener as defined below. and it generally works fine however i see a it constantly disconnecting and reconnecting based on the recieveTimeout setting.
<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<!-- mrgm connection to the jca adapter -->
<property name="connectionFactory" ref="mrgmConnectionFactory" />
<!-- name of the topic -->
<property name="destinationName" value="test.destinationname" />
<!-- class which will listen for messages (must implement javax.jms.MessageListener -->
<property name="messageListener" ref="TestListener" />
<property name="sessionTransacted" value="true" />
<property name="receiveTimeout" value="1000" />
<!--turning this on drops all messages -->
<!-- <property name="pubSubDomain" value="true" /> -->
</bean>
I have done some test and when there are alot of messages being posted to the topic it will drop some because if the message comes during the small period between the disconnect and reconnect it will obviously be missed by the listener.
if i set the recieveTimeout to 0 this problem goes away. should i always set the recieveTimeout to 0 when listenting on a topic? or am I going about this whole process the wrong way.
When disconnecting and reconnecting, if your subscriber is not durable, you might loose messages. However the spring DMLC should not reconnect. Can you troubleshoot that a bit more? It should essentially subscribe to a topic
session.createConsumer(..)then loopconsumer.receive()orconsumer.receive(timeout). Not sure why your DMLC reconnects when setting the timeout higher.You should be fine with no timeout, though, but you might want to track the cause to the reconnect with debug logging etc.