2016-07-07 4 views
2

メッセージの有効期限切れargsを持つキューを作成しましたが、サーバの起動中に次のエラーが表示されます。SpringAMQP argsを使ったキュー作成

[SimpleAsyncTaskExecutor-1] o.s.a.r.c.RabbitAdmin [RabbitAdmin.java:375] Auto-declaring a non-durable Queue (TEST_QUEUE). It will be redeclared if the broker stops and is restarted while the connection factory is alive, but all messages will be lost. 
pool-1-thread-1] o.s.a.r.c.CachingConnectionFactory [CachingConnectionFactory.java:249] Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'EXP_MSG' in vhost '/': received 'false' but current is 'true', class-id=50, method-id=10) 
ERROR [SimpleAsyncTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer [SimpleMessageListenerContainer.java:914] Failed to check/redeclare auto-delete queue(s). 
org.springframework.amqp.AmqpIOException: java.io.IOException 
    at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:63) ~[spring-rabbit-1.4.0.RELEASE.jar:na] 
    at org.springframework.amqp.rabbit.connection.RabbitAccessor.convertRabbitAccessException(RabbitAccessor.java:110) ~[spring-rabbit-1.4.0.RELEASE.jar:na] 

私は、Springブート1.2.8とSpring 4.2.5バージョンを使用します。

@Bean 
    Queue expiredMessageQueue() { 
     Map args = new HashMap(); 
     args.put("x-message-ttl", 60000); 
     return new Queue(expiredMessageQueue, false, false, false,args); 
    } 

答えて

2

バーチャルホストでのキューのための「耐久性のある」「EXP_MSG」引数非等価「/」:「偽」は現在の受信「真」である

、このような提示がすでに存在することを意味RabbitMQ Brokerのキューではありますが、プロパティは異なります。

アプリケーションを変更してアプリケーションから再作成したければ、アプリケーションを起動する前にまずそれをブローカから削除する必要があります。または、すべてのオプションを既存のものと揃えます。

これはpassiveDeclarationのように呼ばれます。リスナーは、サブスクライブするために実際のキューを正確に必要とします。そして、それが望ましい状態で存在するかどうかをチェックする理由があるだけです。リスナーの開始時にそれを宣言してください。

+0

こんにちはArtem、情報ありがとうございます。それは今働きます! – sea

関連する問題