2

I am using spring-rabbit1.1 and RabbitMQ 3.3.1 ,

My spring configuration will create any queue with the help of RabbitTemplate on Rabbit MQ but if the queue has been configured with x-dead-letter-exchange and x-message-ttl , it just creates the queue with out the TTL and dead letter exchange.

For Eg : the below queue will create the queue but TTL and dead letter exhange is not getting created .

<rabbit:queue name="hello.queue.dead">
    <rabbit:queue-arguments>
        <entry key="x-dead-letter-exchange" value="hello.activity-task.topic"/>
        <entry key="x-message-ttl" value="10000"/>
    </rabbit:queue-arguments>
</rabbit:queue>

So i had to go and delete the queue from Rabbit MQ and create with all the required values manually to make it work .

Can anyone help me if there is any option to solve this issue ???

4

1 に答える 1

5

キューと交換を明示的に宣言する必要があります...

<rabbit:queue name="q.with.dlx">
    <rabbit:queue-arguments> 
        <entry key="x-dead-letter-exchange" value="dlx"/>
        <entry key="x-message-ttl" value="10000" value-type="java.lang.Long"/>
    </rabbit:queue-arguments>
</rabbit:queue>

<rabbit:queue name="dlq"/>

<rabbit:direct-exchange name="dlx">
    <rabbit:bindings>
        <rabbit:binding key="q.with.dlx" queue="dlq"/>
    </rabbit:bindings>
</rabbit:direct-exchange>

これは、デフォルトの直接交換 (キュー名によるルーティング) を使用して元のメッセージをルーティングしたことを前提としています。したがって、配信不能ルーティングは同じルーティング キー (キュー名) を使用します。明示的なルーティング キーを使用してルーティングする場合は、それを使用します。

ちなみに、 はRabbitTemplateこれらの要素を宣言するのではなく、RabbitAdminインスタンスです。

于 2014-07-21T12:58:16.837 に答える