为什么SpringBoot RabbitMQ客户端会自动关闭与RabbitMQ服务器的连接

时间:2019-07-11 06:08:01

标签: rabbitmq spring-rabbitmq messagebroker persistent-connection tcp-keepalive

**

按以下方法获取rabbitmq连接错误。

**

2019-07-11 13:14:51.147.AMQP连接127.0.0.1:5672>错误-TID [] UID [] MID [] CID []-通道关闭:连接错误;协议方法:#method(回复代码= 541,回复文本= INTERNAL_ERROR,类ID = 0,方法ID = 0) 2019-07-11 13:14:51.831.bulkNotificationContainer-100> WARN-TID [] UID [] MID [] CID []-消费者引发的异常,如果连接工厂支持,则处理可以重新启动 com.rabbitmq.client.ShutdownSignalException:连接错误;协议方法:#method(回复代码= 541,回复文本= INTERNAL_ERROR,类ID = 0,方法ID = 0)     在com.rabbitmq.client.impl.AMQConnection.startShutdown(AMQConnection.java:742)〜[amqp-client-3.6.5.jar!/:na]     在com.rabbitmq.client.impl.AMQConnection.shutdown(AMQConnection.java:732)〜[amqp-client-3.6.5.jar!/:na]     在com.rabbitmq.client.impl.AMQConnection.handleConnectionClose(AMQConnection.java:671)〜[amqp-client-3.6.5.jar!/:na]     在com.rabbitmq.client.impl.AMQConnection.processControlCommand(AMQConnection.java:625)〜[amqp-client-3.6.5.jar!/:na]     在com.rabbitmq.client.impl.AMQConnection $ 1.processAsync(AMQConnection.java:102)〜[amqp-client-3.6.5.jar!/:na]     在com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:143)〜[amqp-client-3.6.5.jar!/:na]     在com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:90)〜[amqp-client-3.6.5.jar!/:na]     在com.rabbitmq.client.impl.AMQConnection $ MainLoop.run(AMQConnection.java:549)〜[amqp-client-3.6.5.jar!/:na]     在java.lang.Thread.run(Thread.java:745)[na:1.8.0_73]

我的spring-boot服务使用Rabbitmq异步发送推送通知。因此,通过rabbitmq发布/接收推送有效负载,然后在FCM上发送。但是,此连接可以正常使用一年,没有任何问题。但是今天早晨,rabbitmq服务器按如下方式重新启动

  1. rabbitmq停止
  2. 杀死进程bean(相关erlang)
  3. rabbitmq开始

此后,我们成功重启了spring-boot服务,并且health-api显示了兔子启动状态。

但是在尝试发送推送时出错。

应用程序属性配置。

  

spring.rabbitmq.host = 127.0.0.1 spring.rabbitmq.port = 5672   spring.rabbitmq.username = rabbitadmin spring.rabbitmq.password = admin

自定义配置

  

rabbitmq.listeners.retry-policy = UNIFORM_RANDOM_DELAY   rabbitmq.listeners.max-interval = 15000   rabbitmq.listener.push-router.concurrent-consumers = 2   rabbitmq.listener.push-router.max-concurrent-consumers = 10

     

rabbitmq.binding.push-notification.queue.name = pushqueue   rabbitmq.binding.push-notification.exchange.name = pushexchange   rabbitmq.binding.push-notification.binding.routing-key = pushroute-binding

我想将数据发布/接收到Rabbitmq频道。

1 个答案:

答案 0 :(得分:0)

重新安装rabbitmq软件包后,此问题已解决。 仍然不知道为什么会这样。.