Клиент amqp кролика весенней шины на длительное время обрывает соединение - PullRequest
0 голосов
/ 22 мая 2018
**Versions**
RabbitMQ 3.6.14. (using docker image rabbitmq:3.6.14-management-alpine)

Java 1.8

spring-cloud-starter-bus-amqp => 1.3.1.RELEASE


 Spring boot parent => 1.5.9.RELEASE

У меня есть установка rabbitmq со службами весенней загрузки, использующей инфраструктуру amqp mvn, чтобы я мог удаленно обновлять конфигурации.Сначала все работает нормально, но затем соединение падает.

стек ошибок ниже Также ссылка: https://docs.google.com/document/d/1Hk3DnA7dMIMevjvoew2Shy5OQsShizrPKRys_U2lghM/edit?usp=sharing

2018-05-22 17:10:49.647 ERROR 9 --- [.X.X.228:5671] c.r.c.impl.ForgivingExceptionHandler     : An unexpected connection driver error occured

com.rabbitmq.client.MissedHeartbeatException: Heartbeat missing with heartbeat = 10 seconds     at com.rabbitmq.client.impl.AMQConnection.handleSocketTimeout(AMQConnection.java:723)   at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:642)     at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)     at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:572)  at java.lang.Thread.run(Thread.java:745)

2018-05-22 17:10:49.652 ERROR 9 --- [.X.X.228:5671] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: connection error 2018-05-22 17:10:49.652 ERROR 9 --- [.X.X.228:5671] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: connection error 2018-05-22 17:10:50.581  INFO 9 --- [NiW8BAjOWTiVA-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@574b7f4a: tags=[{amq.ctag-m35NYazOB0vmhjJHwayDMg=springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA}], channel=Cached Rabbit Channel: AMQChannel(amqp://admin@10.X.X.228:5671/,1), conn: Proxy@76ad6715 Shared Rabbit Connection: SimpleConnection@5a1c3cb4 [delegate=amqp://admin@10.X.X.228:5671/, localPort= 43472], acknowledgeMode=AUTO local queue size=0 2018-05-22 17:10:50.609  INFO 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.c.CachingConnectionFactory       : Created new connection: rabbitConnectionFactory#934b52f:1/SimpleConnection@3cd111c6 [delegate=amqp://admin@10.X.X.78:5671/, localPort= 50792] 2018-05-22 17:10:50.613  INFO 9 --- [NiW8BAjOWTiVA-2] o.s.amqp.rabbit.core.RabbitAdmin         : Auto-declaring a non-durable, auto-delete, or exclusive Queue (springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA) durable:false, auto-delete:true, exclusive:true. It will be redeclared if the broker stops and is restarted while the connection factory is alive, but all messages will be lost. 2018-05-22 17:10:50.617 ERROR 9 --- [0.X.X.78:5671] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: channel error; protocol method:
#method<channel.close>(reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10) 2018-05-22 17:10:50.619  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.amqp.rabbit.core.RabbitAdmin         : Failed to declare queue: Queue [name=springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA, durable=false, autoDelete=true, exclusive=true, arguments={}], continuing... com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10) 2018-05-22 17:10:50.621 ERROR 9 --- [0.X.X.78:5671] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: channel error; protocol method:
#method<channel.close>(reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=20) 2018-05-22 17:10:50.623  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.amqp.rabbit.core.RabbitAdmin         : Failed to declare binding: Binding [destination=springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA, exchange=springCloudBus, routingKey=#], continuing... com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=20) 2018-05-22 17:10:50.629 ERROR 9 --- [0.X.X.78:5671] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: channel error; protocol method:
#method<channel.close>(reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10) 2018-05-22 17:10:50.630  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.listener.BlockingQueueConsumer   : Failed to declare queue: springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA 2018-05-22 17:10:50.631  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.listener.BlockingQueueConsumer   : Queue declaration failed; retries left=3

org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s):[springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA]   at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:672)    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:571)     at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1424)     at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: null   at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:123)  at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:992)     at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:50)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:980)     at com.sun.proxy.$Proxy155.queueDeclarePassive(Unknown Source)  at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:651)    ... 3 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)   at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)     at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)  at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)  at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)  ... 12 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)  at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:505)   at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:336)    at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:143)    at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:90)  at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:634)     at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)     at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:572)  ... 1 common frames omitted

2018-05-22 17:10:55.635  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.listener.BlockingQueueConsumer   : Failed to declare queue: springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA 2018-05-22 17:10:55.636  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.listener.BlockingQueueConsumer   : Queue declaration failed; retries left=2

org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s):[springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA]   at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:672)    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:571)     at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1424)     at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: null   at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:123)  at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:992)     at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:50)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:980)     at com.sun.proxy.$Proxy155.queueDeclarePassive(Unknown Source)  at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:651)    ... 3 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)   at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)     at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)  at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)  at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)  ... 12 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)  at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:505)   at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:336)    at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:143)    at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:90)  at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:634)     at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)     at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:572)  ... 1 common frames omitted

2018-05-22 17:11:00.656  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.listener.BlockingQueueConsumer   : Failed to declare queue: springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA 2018-05-22 17:11:00.657  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.listener.BlockingQueueConsumer   : Queue declaration failed; retries left=1

org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s):[springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA]   at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:672)    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:571)     at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1424)     at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: null   at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:123)  at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:992)     at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:50)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:980)     at com.sun.proxy.$Proxy155.queueDeclarePassive(Unknown Source)  at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:651)    ... 3 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)   at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)     at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)  at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)  at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)  ... 12 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)  at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:505)   at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:336)    at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:143)    at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:90)  at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:634)     at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)     at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:572)  ... 1 common frames omitted

2018-05-22 17:11:05.662  WARN 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.listener.BlockingQueueConsumer   : Failed to declare queue: springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA 2018-05-22 17:11:05.664 ERROR 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.l.SimpleMessageListenerContainer : Consumer received fatal=false exception on startup

org.springframework.amqp.rabbit.listener.QueuesNotAvailableException: Cannot prepare queue for listener. Either the queue doesn't exist or the broker will not allow us to use it.  at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:599)     at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1424)     at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s):[springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA]   at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:672)    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:571)     ... 2 common frames omitted Caused by: java.io.IOException: null    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:123)  at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:992)     at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:50)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:980)     at com.sun.proxy.$Proxy155.queueDeclarePassive(Unknown Source)  at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:651)    ... 3 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)   at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)     at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)  at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)  at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)  ... 12 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)  at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:505)   at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:336)    at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:143)    at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:90)  at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:634)     at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)     at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:572)  ... 1 common frames omitted

2018-05-22 17:11:05.664 ERROR 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.l.SimpleMessageListenerContainer : Consumer received fatal exception on startup

org.springframework.amqp.rabbit.listener.QueuesNotAvailableException: Cannot prepare queue for listener. Either the queue doesn't exist or the broker will not allow us to use it.  at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:599)     at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1424)     at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s):[springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA]   at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:672)    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:571)     ... 2 common frames omitted Caused by: java.io.IOException: null    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:123)  at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:992)     at com.rabbitmq.client.impl.ChannelN.queueDeclarePassive(ChannelN.java:50)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:498)     at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:980)     at com.sun.proxy.$Proxy155.queueDeclarePassive(Unknown Source)  at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.attemptPassiveDeclarations(BlockingQueueConsumer.java:651)    ... 3 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)   at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)     at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)  at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)  at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)  ... 12 common frames omitted Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA' in vhost '/', class-id=50, method-id=10)  at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:505)   at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:336)    at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:143)    at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:90)  at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:634)     at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)     at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:572)  ... 1 common frames omitted

2018-05-22 17:11:05.666 ERROR 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.l.SimpleMessageListenerContainer : Stopping container from aborted consumer 2018-05-22 17:11:05.666  INFO 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.l.SimpleMessageListenerContainer : Waiting for workers to finish. 2018-05-22 17:11:05.666  INFO 9 --- [NiW8BAjOWTiVA-2] o.s.a.r.l.SimpleMessageListenerContainer : Successfully waited for workers to finish.

Любая идея, почему пропадают незанятые соединения.Сердцебиение установлено на 10 секунд.Rabbitmq включен ssl.

1 Ответ

0 голосов
/ 22 мая 2018

osamqp.rabbit.core.RabbitAdmin: автоматическое объявление

недолговременного, автоматическое удаление или исключительная очередь

(springCloudBus.anonymous.eV7zCVLlSNiW8BAjOWTiVA):false,

автоудаление: true, эксклюзив: true.Он будет объявлен повторно, если брокер

остановится и перезапустится, пока фабрика соединений активна, но все сообщения

будут потеряны.2018-05-22 17: 10: 50.617 ОШИБКА 9 ---

[0.XX78: 5671] osarcCachingConnectionFactory: Канал

shutdown: ошибка канала;метод протокола:

метод (код ответа = 405, текст ответа = RESOURCE_LOCKED - невозможно получить эксклюзивный доступ к заблокированной очереди

Похоже, что существует состояние гонки - КроликАдминистратору не удалось повторно объявить анонимную, автоматически удаляемую, исключительную очередь, поскольку старая все еще временно существует.

Впоследствии контейнер попытался сделать пассивное объявление, и к тому времени очереди там не было.

Я думаю, что нам нужно добавить некоторую возможность повторения в RabbitAdmin. Я открыл проблему JIRA .

РЕДАКТИРОВАТЬ

Это немного грубо, но это обходной путь ...

@Bean
public static Object addDelayOnReconnect(CachingConnectionFactory connectionFactory) {
    connectionFactory.addConnectionListener(new ConnectionListener() {

        private final AtomicBoolean initialConnection = new AtomicBoolean(true);

        @Override
        public void onCreate(Connection connection) {
            if (!this.initialConnection.compareAndSet(true, false)) {
                try {
                    System.out.println("Waiting a while for auto-delete queues to be deleted...");
                    Thread.sleep(5_000);
                    System.out.println("Continuing...");
                }
                catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            }
        }

        @Override
        public void onClose(Connection connection) {
            // empty
        }
    });
    return new Object();
}

и

2018-05-22 17:16:45.599  ... : Created new connection: rabbitConnectionFactory#787e4357:1/SimpleConnection@37c0e81b [delegate=amqp://guest@127.0.0.1:5672/, localPort= 50201]
Waiting a while for auto-delete queues to be deleted...
Continuing...
2018-05-22 17:16:50.605 ... : Auto-declaring a non-durable, auto-delete, or exclusive Queue (springCloudBus.anonymous.RQp18TX0SpObVqJSEr64hQ) durable:false, auto-delete:true, exclusive:true. It will be redeclared if the broker stops and is restarted while the connection factory is alive, but all messages will be lost.

Обратите внимание, что я сделал это бином static, потому что мы хотим, чтобы этот слушатель былдобавленный до RabbitAdmin, он работал для меня без static, но с YMMV. Если вы обнаружите, что администратор добавляется первым, вы можете вернуться к замене списка слушателей, используя setConnectionListeners - но обязательно добавьте RabbitAdminв список, поэтому он будет выполнять декларациюion.

Вы могли бы сделать это немного сложнее, вызвав RabbitAdmin.getQueueProperties() в цикле, пока очередь больше не будет присутствовать (хотя, вероятно, не так просто найти имя очереди).

EDIT2

Вот лучший способ обойти - переопределить Boot's AmqpAdmin bean ...

@Bean
public AmqpAdmin amqpAdmin(ConnectionFactory connectionFactory) {
    return new RabbitAdmin(connectionFactory) {

        @Override
        public void initialize() {
            while (true) { // might want to give up after some number of tries
                try {
                    super.initialize();
                    break;
                }
                catch (Exception e) {
                    System.out.println("Failed to declare elements: " + e.getCause().getCause().getMessage());
                    try {
                        Thread.sleep(1_000);
                    }
                    catch (InterruptedException e1) {
                        Thread.currentThread().interrupt();
                    }
                }
            }
        }

    };
}
...