web-dev-qa-db-ja.com

スプリングブーツを使用したrabbitmqの例外

スプリングブートアプリケーションをrabbitmqで起動すると、次の例外が繰り返し発生します。以下の例外を除いて、フロー全体が正常に機能しています。それは手段による自動削除と関係がありますか?

    08 Jul 2015 16:20:17,652 [ERROR] [SimpleAsyncTaskExecutor-2] SimpleMessageListenerContainer| Failed to check/redeclare auto-delete queue(s).
    Java.util.concurrent.TimeoutException
        at com.rabbitmq.utility.BlockingCell.get(BlockingCell.Java:77)
        at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.Java:111)
        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)
        at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.Java:621)
        at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.Java:665)
        at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.Java:208)
        at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.Java:444)
        at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.Java:80)
        at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.Java:130)
        at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.Java:67)
        at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.Java:1035)
        at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.Java:1028)
        at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.Java:1004)
        at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.Java:254)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.Java:963)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$300(SimpleMessageListenerContainer.Java:83)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.Java:1081)
        at Java.lang.Thread.run(Thread.Java:745)

08 Jul 2015 16:52:47,148 [WARN ] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Consumer raised exception, processing can restart if the connection factory supports it
Java.util.concurrent.TimeoutException
    at com.rabbitmq.utility.BlockingCell.get(BlockingCell.Java:77)
    at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.Java:111)
    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)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.Java:621)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.Java:665)
    at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.Java:208)
    at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.Java:444)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.Java:80)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.Java:130)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.Java:67)
    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.Java:434)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.Java:1083)
    at Java.lang.Thread.run(Thread.Java:745)

以下は私の豆です

 <rabbit:queue id="reportQueue" name="reportQueue" durable="true" auto-delete="false" exclusive="false"/>


 <rabbit:direct-exchange id="reportExchange" durable="true" name="reportExchange">
     <rabbit:bindings>
        <rabbit:binding queue="reportQueue" key="reportBind"></rabbit:binding>
     </rabbit:bindings>
 </rabbit:direct-exchange>


  <bean id="aListener" class="com.sample.ReportMessageListener" autowire="byName"/>
  <bean id="reportMessageConverter" class="com.sample.ReportMessageConverter"/>
 <rabbit:listener-container id="myListenerContainer" connection-factory="connectionFactory" acknowledge="auto" prefetch="5" concurrency="1" message-converter="reportMessageConverter" >
    <rabbit:listener ref="aListener" queues="reportQueue"/>
</rabbit:listener-container>

更新:

デバッグを有効にすると、メッセージは次のようになります。

09 Jul 2015 14:46:35,284 [DEBUG] [main] SimpleMessageListenerContainer| Starting Rabbit listener container.
09 Jul 2015 14:46:38,601 [DEBUG] [elasticsearch[local_jvm_node][clusterService#updateTask][T#1]] service                  | [local_jvm_node] processing [routing-table-updater]: execute
09 Jul 2015 14:46:38,602 [DEBUG] [elasticsearch[local_jvm_node][clusterService#updateTask][T#1]] service                  | [local_jvm_node] processing [routing-table-updater]: no change in cluster_state
09 Jul 2015 14:46:40,324 [ERROR] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Failed to check/redeclare auto-delete queue(s).
Java.util.concurrent.TimeoutException
    at com.rabbitmq.utility.BlockingCell.get(BlockingCell.Java:77)
    at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.Java:111)
    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)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.Java:621)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.Java:665)
    at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.Java:208)
    at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.Java:444)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.Java:80)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.Java:130)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.Java:67)
    at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.Java:1035)
    at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.Java:1028)
    at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.Java:1004)
    at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.Java:254)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.Java:963)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$300(SimpleMessageListenerContainer.Java:83)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.Java:1081)
    at Java.lang.Thread.run(Thread.Java:745)
09 Jul 2015 14:46:40,328 [DEBUG] [SimpleAsyncTaskExecutor-1] BlockingQueueConsumer    | Starting consumer Consumer: tags=[{}], channel=null, acknowledgeMode=MANUAL local queue size=0
09 Jul 2015 14:46:45,333 [DEBUG] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Recovering consumer in 5000 ms.

09 Jul 2015 14:46:50,402 [WARN ] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Consumer raised exception, processing can restart if the connection factory supports it
Java.util.concurrent.TimeoutException
    at com.rabbitmq.utility.BlockingCell.get(BlockingCell.Java:77)
    at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.Java:111)
    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)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.Java:621)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.Java:665)
    at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.Java:208)
    at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.Java:444)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.Java:80)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.Java:130)
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.Java:67)
    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.Java:434)
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.Java:1083)
    at Java.lang.Thread.run(Thread.Java:745)
09 Jul 2015 14:46:50,403 [INFO ] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Restarting Consumer: tags=[{}], channel=null, acknowledgeMode=MANUAL local queue size=0
09 Jul 2015 14:46:50,403 [DEBUG] [SimpleAsyncTaskExecutor-1] BlockingQueueConsumer    | Closing Rabbit Channel: null
8
Pradeep

RabbitMQを再起動すると、これが解決しました(Mac)。

cd /usr/local/sbin 
./rabbitmqctl stop_app
./rabbitmqctl start_app
3
izilotti

自動削除キューとは何の関係もありません(コンテナがライフサイクルのこの特定の時点で接続を初期化しているという意味があるという事実を除いて)。

ネットワークに問題があるようです...

Java.util.concurrent.TimeoutException
....
    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.Java:293)

接続開始コマンドの応答を待機し、サーバーが時間内に応答しない場合、rabbitmqクライアントライブラリにはハードコードされた5秒のタイムアウトがあります。

1
Gary Russell

春うさぎバージョンだと思います。私はあなたと同じ問題に遭遇しました。しかし、私はそれを修正する考えがありません。しかし、私の別のプロジェクトでは、それはうまく機能します。次に、2つのプロジェクトを比較しました。春ウサギバージョンが違うことに気づきました。

<dependency>
  <groupId>org.springframework.amqp</groupId>
  <artifactId>spring-rabbit</artifactId>
  <version>1.6.5.RELEASE</version>
</dependency>

この新しいバージョンはTimeoutExceptionをスローします。だが

<dependency>
  <groupId>org.springframework.amqp</groupId>
  <artifactId>spring-rabbit</artifactId>
  <version>1.4.5.RELEASE</version>
</dependency>

このバージョンはうまく機能します。私のスプリングブートバージョンは「Camden.SR2」です。デフォルトのスプリングラビット1.6.5.RELEASE。

それがあなたを助けることを願っています

0
Changel