Spring - JMS , after couple of start/stop of JMS activemq server, listener server throws java.io.EOFException and then does not connect to running JMS -
i have following setting in spring context file.
<bean id="amqpowerconnectionfactory" class="org.apache.activemq.activemqconnectionfactory"> <constructor-arg index="0" value="${power.messagebrokerurl}"/> </bean> <bean id="powerconnectionfactory" class="org.springframework.jms.connection.cachingconnectionfactory"> <constructor-arg ref="amqpowerconnectionfactory"/> </bean> <bean id="powereventqueue" class="org.apache.activemq.command.activemqqueue"> <constructor-arg value="powereventqueue"/> </bean> <bean id="timeserieschangescontainer" class="org.springframework.jms.listener.defaultmessagelistenercontainer"> <property name="connectionfactory" ref="powerconnectionfactory"/> <property name="destination" ref="powereventqueue"/> <property name="messagelistener" ref="timeseriesdataadapter"/> <property name="recoveryinterval" value="5000"/> </bean> <bean id="timeseriesdataadapter" class="com.sungard.energy.aligne.aligneweb.assetmanagement.timeseriesmessageadapter"> <property name="queuename"><value>"powereventqueue"</value></property> <property name="messagehandler" ref="timeseriesmessagehandler"/> </bean> <bean id="timeseriesmessagehandler" class="com.sungard.energy.aligne.aligneweb.assetmanagement.timeseriesmessagehandler"> </bean>
"${power.messagebrokerurl}" tcp://localhost:61616 i.e. jms activemq running locally on machine.
app server listening activemq jms, when jms goes down , app server shows following message, right since jms down , it's trying see if it's or not @ every 5 seconds.
warn defaultmessagelistenercontainer:844 - setup of jms message listener invoker failed destination 'queue://powereventqueue' - trying recover. cause: *consumer* closed not refresh jms connection destination 'queue://powereventqueue' - retrying in 5000 ms. cause: not connect broker url: tcp://localhost:61616. reason: java.net.connectexception: connection refused: connect
now when restart jms, app server connects , shows following message.
info defaultmessagelistenercontainer:893 - refreshed jms connection warn cachingconnectionfactory:301 - encountered jmsexception - resetting underlying jms connection
now when take down jms server again appserver instead of showing connection refused shows following message.
warn defaultmessagelistenercontainer:844 - setup of jms message listener invoker failed destination 'queue://powereventqueue' - trying recover. cause: session closed info cachingconnectionfactory:291 - established shared jms connection: activemqconnection {id=id:ap-pun-ws0430-53381-1437557704588-0:28,clientid=null,started=false} error defaultmessagelistenercontainer:909 - not refresh jms connection destination 'queue://powereventqueue' - retrying in 1000 ms. cause: jms connection has failed: java.io.eofexception
and if start jms server, appserver not reconnect , continuously throws java.io.eofexception
on thing observed @ before successful reconnection jms, part of log message says , cause: consumer closed
where-as in other case says cause: session closed , following line
info cachingconnectionfactory:291 - established shared jms connection: activemqconnection {id=id:ap-pun-ws0430-53381-1437557704588-0:28,clientid=null,started=false}
value power.messagebrokerurl set
power.messagebrokerurl=tcp://localhost:61616
if add failover in beginning of it, don' see error.
power.messagebrokerurl=failover:tcp://localhost:61616
update: above settings, listener server expected jms , running when starts. have add startupmaxreconnectattempts attribute values 1. default value -1 (i using activemq 5.5.0) signifies transport have no limit number of initial connection attempts , that's reason listener server not starting.
power.messagebrokerurl=failover:(tcp://localhost:61616)?startupmaxreconnectattempts=1
you can refer http://activemq.apache.org/failover-transport-reference.html transport options.
Comments
Post a Comment