spring spring流中的rabbitmq连接恢复问题

时间:2018-02-07 13:30:24

标签: java spring rabbitmq spring-cloud-stream spring-rabbitmq

我是spring的新用户,我使用rabbitmq中的spring-cloud-stream。我在这里使用rabbitmq 4.0.7的版本。版本spring-AMQP 1.7。我检查了所有的事情,但我无法解决问题。所以,错误是

Caught an exception during connection recovery!
java.io.IOException
    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:350)
    at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:36)
    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.recoverConnection(AutorecoveringConnection.java:476)
    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.beginAutomaticRecovery(AutorecoveringConnection.java:444)
    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.access$000(AutorecoveringConnection.java:53)
    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection$1.shutdownCompleted(AutorecoveringConnection.java:383)
    at com.rabbitmq.client.impl.ShutdownNotifierComponent.notifyListeners(ShutdownNotifierComponent.java:75)
    at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:578)
    at java.lang.Thread.run(Thread.java:748)
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
    at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
    at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:37)
    at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:367)
    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293)
    ... 8 more
Caused by: java.io.EOFException
    at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:290)
    at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
    at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:139)
    at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:538)
    ... 1 more


Channel channel = (Channel)message.getHeaders().get(AmqpHeaders.CHANNEL);

这样我创建了频道,我有一个application.yml文件,我设置了所有的绑定属性。可以告诉我这个的原因吗?

1 个答案:

答案 0 :(得分:0)

1.7.1默认情况下禁用自动恢复(除非您将预先配置的Rabbit ConnectionFactory注入CachingConnectionFactory)。

默认情况下,它在1.7.0中未正确启用。

Spring AMQP不需要自动恢复,它自1.0以来就有自己的连接恢复机制。

目前的1.7.x版本是1.7.6;当前(首选)版本是2.0.2。

这并不能解释EOFException(通常,自动恢复仍然有效 - 只是不需要)。