Skip to content

Publish MaxRetries error-queue messages as persistent with the original properties - #92

Closed
AlexMarold wants to merge 1 commit into
mainfrom
max-retries-persistent-error-queue
Closed

AlexMarold wants to merge 1 commit into
mainfrom
max-retries-persistent-error-queue

Conversation

@AlexMarold

Copy link
Copy Markdown
Member

Tracking issue: ivx/product#38301

Why

Ears::Middlewares::MaxRetries published messages to the error queue as transient messages, so a broker restart dropped them from a classic queue. It also published only the payload, so the headers, content_type, message_id and timestamp of the original message were lost. Messages in an error queue are parked for later inspection or replay, so this loses data.

What changes for users

  • The error-queue message is always persistent, also when the original was transient.
  • The message keeps the properties and headers of the original, except user_id (RabbitMQ rejects a publish whose user_id differs from the connection user) and the x-death header (so a message that you move back to the main queue is processed again).
  • The received timestamp is converted to an integer before it is published. Bunny decodes it as Time but cannot encode a Time again.
  • MaxRetries still acks the original message after the publish.
  • README: register MaxRetries before any middleware that changes the body (for example JSON). Otherwise MaxRetries gets the parsed body, not the original text.
  • Release 0.28.0.

Out of scope: publisher confirms for the error-queue publish (follow-up). Messages that are already in an error queue stay transient.

🤖 Generated with Claude Code

…erties

A broker restart dropped messages that MaxRetries had moved to the error
queue on classic queues, because it published only the payload as a
transient message. It also lost the headers, content type, message id and
timestamp of the original message.

MaxRetries now publishes with delivery mode 2 and copies the properties of
the received message. It removes the x-death header, so a message that is
moved back to the main queue is processed again, and it does not copy
user_id, because RabbitMQ rejects a publish whose user_id differs from the
connection user. The timestamp is converted from Time to an integer,
because Bunny decodes it as Time but cannot encode it again. The delivery
mode is set after the copy, because Bunny only derives it when the options
do not contain one.

Messages that are already in an error queue stay transient. MaxRetries
still acks without publisher confirms. The release is 0.28.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AlexMarold

Copy link
Copy Markdown
Member Author

Closing unmerged. Error-queue messages are already persistent on main, and we don't need the original properties. See ivx/product#38301.

@AlexMarold AlexMarold closed this Oct 28, 2026
@AlexMarold
AlexMarold deleted the max-retries-persistent-error-queue branch October 28, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant