Hi
I am using spring-rabbit 1.1.2.RELEASE version in my producer and consumer application.
The producer application is working fine and can send messages to the rabbitmq queues without any issue. Bu tye consumer application having issues and print the below warning when the listener getting initialized.
WARN [SimpleMessageListenerContainer] Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused
When the consumer application starts, both rabbitmq servers are up and running and property values (server name, ports) and passed correctly.
The spring config as below.
Could someone please help me to resolve this issue. Thanks.Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rabbit="http://www.springframework.org/schema/rabbit" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:property-placeholder location="file:/app/rabbitmq.properties" ignore-unresolvable="true" /> <!-- Rabbit MQ connectivity --> <rabbit:connection-factory id="connectionFactory" addresses="${system.distributed.rabbitmq.host}" username="${system.distributed.rabbitmq.username}" password="${system.distributed.rabbitmq.password}" channel-cache-size="2" /> <rabbit:admin connection-factory="connectionFactory"/> <bean id="jsonConverter" class="org.springframework.amqp.support.converter.JsonMessageConverter"/> <bean name="errorHandler" class="biz.hub.queue.RabbitErrorHandler"/> <bean id="jsonFactory" class="org.codehaus.jackson.JsonFactory"/> <rabbit:listener-container connection-factory="connectionFactory" message-converter="jsonConverter" concurrency="2" error-handler="errorHandler"> <rabbit:listener ref="receiveListner" method="handleMessage" queue-names="${system.distributed.exchange.queue}"/> </rabbit:listener-container> <bean id="receiveListner" class="biz.hub.queue.ConsumerHandler"> <constructor-arg ref="jsonFactory" /> </bean> </beans>


Reply With Quote