Search code examples
node.jsrabbitmqnode-modulesamqpseneca

Seneca amqp transport's dead letter exchange x-message-ttl


I am updating seneca-amqp-transport npm package from 2.1.0 to 2.2.0.

I am getting below error while starting the seneca.js microservice.

{"message":"Channel closed","stackAtStateChange":"Stack capture: Channel closed by server: 406 (PRECONDITION-FAILED) with message "PRECONDITION_FAILED - inequivalent arg 'x-message-ttl'for queue 'seneca.add.role:worker.cmd:any' in vhost '/': received the value '60000' of type 'signedint' but current is the value '360000' of type 'signedint'"\n at Channel.C.accept...

What i understood with this message is x-message-ttl value is different what we are setting in the code and in the rabbitmq queue. I checked the rabbitmq queue and there x-message-ttl time is 360000. Also checked in code there also x-message-ttl is 360000.

{
          queues: {
            prefix: "seneca.add",
            separator: ".",
            options: {
              durable: true,
              arguments: {
                "x-dead-letter-exchange": "seneca.dlx",
                "x-message-ttl": 360000
              }
            }
          }
        }


I checked change log but not getting what got changed due to which i am getting this error.


Solution

  • I have found the solution. In seneca-amqp-protocol version 2.2.0 they updated the con figuration option. Update configuration options to

    Old Config

    {amqp: {
        listen: {
          channel: {
            prefetch: 1
          },
          queues: {
            prefix: "seneca.add",
            separator: ".",
            options: {
              durable: true,
              arguments: {
                "x-dead-letter-exchange": "seneca.dlx",
                "x-message-ttl": 360000
              }
            }
          }
        }
      }}
    

    New Config

    {amqp: {
        listener: {
          channel: {
            prefetch: 1
          },
          queues: {
            prefix: "seneca.add",
            separator: ".",
            options: {
              durable: true,
              arguments: {
                "x-dead-letter-exchange": "seneca.dlx",
                "x-message-ttl": 360000
              }
            }
          }
        }
      }}