Hallo :-)
I have a central logging server which is supposed to receive logging-messages from a number of clients. Basically it works well. If the logging-server is down I want the clients to retry sending the messages until he is online again (or at lest some times). Unfortunately i was not able to find out how to do this yet. I hope you can help me.
I use spring-3.0.3 and activemq 5.2.0.
This is my server-configuration:
The client configuration looks like :Code:<amq:broker useJmx="false" persistent="false"> <amq:transportConnectors> <amq:transportConnector uri="tcp://localhost:61616" /> </amq:transportConnectors> </amq:broker> <jms:listener-container concurrency="10"> <jms:listener id="QueryLoggerListener" destination="QueryLogger" ref="queryLogger" /> </jms:listener-container> <!--QueryLogger implements MessageListener --> <!--Writes the log-msg into a db --> <bean id="queryLogger" class="de.it2media.smsc.statisticserver.logger.QueryLogger"> </bean> <amq:connectionFactory id="amqConnectionFactory" brokerURL="tcp://localhost:61616" /> <bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"> <constructor-arg ref="amqConnectionFactory" /> <property name="exceptionListener" ref="jmsExceptionListener" /> <property name="sessionCacheSize" value="100" /> </bean> <bean id="jmsExceptionListener" class="de.it2media.smsc.logging.JmsExceptionListener"></bean>
This class is used to send the messages to the server :Code:<amq:connectionFactory id="amqConnectionFactory" brokerURL="tcp://localhost:61616" /> <bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"> <constructor-arg ref="amqConnectionFactory" /> <property name="exceptionListener" ref="jmsExceptionListener" /> <property name="sessionCacheSize" value="10" /> </bean> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate" > <constructor-arg ref="connectionFactory" /> </bean> <!-- This bean is used by the different client classes to send log-msg to the logging-server --> <bean id="statisticLogger" class="de.it2media.smsc.logging.StatisticLogger"> <constructor-arg ref="jmsTemplate" /> </bean> <bean id="jmsExceptionListener" class="de.it2media.smsc.logging.JmsExceptionListener"></bean>
If the logging-server is down i get aCode:public class StatisticLogger { private final JmsTemplate jmsTemplate; public static enum Destinations { QueryLogger }; public StatisticLogger( final JmsTemplate jmsTemplate ) { this.jmsTemplate = jmsTemplate; } public void send( String message, Destinations destination ) { try{ this.jmsTemplate. convertAndSend(destination.toString(),message); } catch(Exception e) { LOGGER.debug("Error : {}",e.getMessage()); } } }
Exception.Code:Error : Uncategorized exception occured during JMS processing; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect
Thank you for your help in advance!


Reply With Quote
