Search code examples
node.jsrabbitmqnode-amqp

Queue routing to default exchange even when DLX argument set


Really confused here...

Have a queue with dead letter props set...

var amqp = require('amqp'),
    conn = amqp.createConnection();

var key = "batch.delay." + (new Date().getTime()).toString();
var options = {
  arguments: {
    "x-dead-letter-exchange": "immediate",
    "x-message-ttl": 30000,
    "x-expires": 40000,
    "x-dead-letter-routing-key": 'hit.api'
  }
};

conn.queue(key, options);

and defining the actual exchange...

conn.exchange('immediate', {
  durable: true,
  autoDelete: false,
  type: 'direct'
}, function (exchange) {
  // other thing...
});

The problem is that all traffic is going through the default exchange and not the dead letter exchange. The ttl props are being honored but not the exchange name. That is seen here...

enter image description here

Ideas?

Edit:

below you can see the queues created that should funnel into the DLX once they expire.

enter image description here


Solution

  • Okay, so.. it was this:

    • Creating a queue that expires to a DLX? Check.
    • Creating the DLX? Check.
    • Pushing data to the queue that expires? Nope.

    It was a scoping issue... I thought that I was looping over data that would publish to the queue that was expiring, but the data was always an empty array so nothing was ever published.

    Once I figured this out, the queues would fill with data, expire to the DLX, and queues bound to the DLX would pick up the data.

    Big thanks to @jhilden for talking it out w/ me.