我们正在使用Spring AMQP 2.8和RabbitMQ 2.8.7版本。我们正在建立我们的连接工厂,如下所示。
<!-- RabbitMQ Local connectivity -->
<rabbit:connection-factory
id="localWhispirConnectionFactory"
addresses="${system.local.rabbitmq.host}"
username="${system.local.rabbitmq.username}"
password="${system.local.rabbitmq.password}"
connection-factory="rabbitWhispirLocalFactory"/>
<!-- Heartbeat configuration every 10sec -->
<bean id="rabbitWhispirLocalFactory" class="com.rabbitmq.client.ConnectionFactory">
<property name="requestedHeartbeat" value="10" />
</bean>
但是当服务器负载不足时,我们收到了以下异常。尝试了几种方法,但感谢任何评论来克服这个问题。
2015-04-20 12:01:00,174 INFO [SimpleMessageListenerContainer] Restarting Consumer: tag=[amq.ctag-wfazQuIuS-BM-CosxP_2GJ], channel=Cached Rabbit Channel: AMQChannel(amqp://whispir@10.50.50.128:5672/,62), acknowledgeMode=AUTO local queue size=0
2015-04-20 12:01:00,156 WARN [SimpleMessageListenerContainer] Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: java.net.SocketException: Broken pipe
2015-04-20 12:01:00,174 INFO [SimpleMessageListenerContainer] Restarting Consumer: tag=[amq.ctag-AjjxOJ2doe4yi2GtTHKumM], channel=Cached Rabbit Channel: AMQChannel(amqp://whispir@10.50.50.128:5672/,29), acknowledgeMode=AUTO local queue size=0
感谢。