Skip to content

x-death header count is no longer incremented from RabbitMQ version 3.13.0+ #11331

@cressie176

Description

@cressie176

Describe the bug

Prior to v13.13.0, when a message is rejected and routed to a dead letter queue, the broker maintains an "x-death" header added similar to the following...

[
  {
    "count": 1,
    "reason": "rejected",
    "queue": "q1",
    "time": {
      "!": "timestamp",
      "value": 1716827089
    },
    "exchange": "",
    "routing-keys": [
      "q1"
    ]
  }
]

if the message is moved from the dead letter queue back the work queue, and again rejected, the count property is updated by the broker, i.e.

[
  {
    "count": 2,
    "reason": "rejected",
    "queue": "q1",
    "time": {
      "!": "timestamp",
      "value": 1716827089
    },
    "exchange": "",
    "routing-keys": [
      "q1"
    ]
  }
]

From RabbitMQ v13.13.0 the count is no longer updated. I'm author of a RabbitMQ client for Node.js called Rascal, and was about to rely on the incrementing count for this feature.

There isn't any mention of this breaking change in the v13.13.0 release notes, but I see there is a related issue. Similar to the author of this issue, I am also not editing the x-death header, but am relying on the broker maintaining the count. I am unable to maintain this in a custom header since I would need to modify the message on rejection, which is not possible. If the decision is for x-death to be "broker only" and to ignore this header when published from the client, that's no problem, but to maintain backwards compatibility, the broker must count the rejections.

In #10709 you also advise that RabbitMQ v4 is likely to make header's starting with 'x-' broker only. Thankfully none of Rascal's custom headers take this format, but wouldn't this mean that any messages with custom 'x-' headers that are in flight / enqueued when the broker is upgraded might be broken?

Reproduction steps

  1. Configure a work queue with a dead letter exchange / dead letter queue
  2. Publish a message to the work queue
  3. Reject the message with requeue false
  4. Move the message to the work queue
  5. Rerject the message with requeue false again

The message should have an 'x-death' record with a count of 2, but instead it has a count of 1

Expected behavior

The x-death record's count property should be incremented whenever a message is rejected.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions