Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set x-dead-letter-exchange in Rabbit?

Here are my beans:

    @Bean
    public Queue igSmev3ListenerQueue() {
        Map<String, Object> args = new HashMap<>();
        args.put("x-dead-letter-exchange", rabbitIgSmev3DlxProperties.getExchangeName());
        args.put("x-dead-letter-routing-key", rabbitIgSmev3DlxProperties.getRoutingKey());
        return new Queue(rabbitIgSmev3ListenerProperties.getQueueName(), true, false, false, args);
    }

    @Bean
    public Queue igSmev3DlxQueue() {
        return new Queue(rabbitIgSmev3DlxProperties.getQueueName(), true, false, false);
    }

Here are application.yml settings:

listener:
  vhost: /
  exchangeName: igSmev3Listener
  queueName: igSmev3-ListenerQueue
  routingKey: igSmev3-Listener
dlx:
  vhost: /
  exchangeName: igSmev3Dlx
  queueName: igSmev3-DlxQueue
  routingKey: igSmev3-Dlx

My current error:

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'igSmev3-ListenerQueue' in vhost '/': received none but current is the value 'igSmev3Dlx' of type 'longstr', class-id=50, method-id=10)

How can I solve it? I need to take dead letters from listenerQueue and put them to dlxQueue

like image 975
Maksym Rybalkin Avatar asked Oct 20 '25 02:10

Maksym Rybalkin


1 Answers

inequivalent arg 'x-dead-letter-exchange' for queue 'igSmev3-ListenerQueue' in vhost '/': received none but current is the value 'igSmev3Dlx' of type 'longstr'

That means that you have a igSmev3-ListenerQueue queue on the broker already and it is without an 'x-dead-letter-exchange' argument. Probably you have created it before with that state.

Consider to remove this queue before starting your application with already DLX provided.

like image 105
Artem Bilan Avatar answered Oct 21 '25 16:10

Artem Bilan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!