Tag Archives: Daily java basic bug

rabbit.listener.BlockingQueueConsumer$DeclarationException: Failed to declare queue(s)-2021-10-09

  Today’s Bug

I   Error: failed to start the order micro service. The message listening class cannot find the queue

org.springframework.amqp.rabbit.listener.BlockingQueueConsumer$DeclarationException:   Failed   to   declare   queue(s):[queue.ordertimeout]

  2、 Reason:   The configured dead letter queue is invalid and cannot be found

3、 Review the following configuration steps:

        1. Create switch: exchange.ordertimeout – & gt; Fanout type

        2. Create queue: queue.ordertimeout

        3. Bind switch exchange.ordertimeout and queue.ordertimeout

        4. Create queue.ordercreate

                (1) Arguments1: s-message-ttl=10000

                (2) Arguments2: x-dead-letter-exchange: exchange.ordertimeout  

          5. Principle: after creating an order – & gt; The lifetime of message queue.ordercreate is 10 seconds – & gt; After expiration, enter the dead letter exchange.ordertimeout – & gt;   Forward to message queue.ordertimeout