What happens to a message nothing can read¶
The bus can only hand a handler an event. When a message arrives that no format in Settings.Reads
can turn into one, the adapter settles it itself, counts it, and never builds a Delivery. The
core's rule is spec 0015;
this page is what the RabbitMQ adapter does.
What counts as unreadable¶
envelope.Read is given the message's content_type property, its string headers and its body, and
the chain in Reads. It fails when:
- no format claims the message, such as a body that is not an event, or a content type none of the formats recognises;
- more than one format claims it. The reader will not guess between them;
- one format claims it and cannot decode it, such as a structured CloudEvent whose body lacks required attributes.
All three take the same path. The default chain is CloudEvents binary then structured, so a message
written by an interop format is unreadable unless that format is in Reads.
At-least-once¶
The adapter, in order:
- adds one to
Unreadable; - logs a warning naming the subscription, the queue and the error;
- declines the message at once, with no handler involved and no lease started.
The decline is the same one a handler's Nack becomes. While the message's attempt is below
MaxDeliver it is rejected with requeue, and the broker counts a failed delivery. On its last
attempt it is rejected without requeue, and the broker dead-letters it. There is no delay between
attempts.
Because the requeued message comes back and fails again, each attempt is counted: an unreadable
message adds MaxDeliver to Unreadable before it dead-letters.
It is not counted Exhausted: it was never offered to a handler. Nor is it counted Accepted;
that is counted only after a successful read. It does not take a slot in the source's buffer.
At-most-once¶
The broker acknowledged the message when it delivered it, so the adapter has nothing to settle. It
adds one to Unreadable, logs the same warning, and drops the message. Nothing comes back and
nothing is dead-lettered.
If settling fails¶
Declining can fail only when the channel is closed. The adapter logs
declining a message that could not be read failed and relies on the channel-close handler, which
ends the source and records the cause. The broker returns the unacknowledged message when the
channel closes.
What the suite proves¶
The conformance row AnUnreadableMessageNeverReachesAHandler runs for each of the three kinds, under
both modes, with a bound of 2. It sends three unreadable messages one at a time, then a readable
one, and expects the readable one to be the only delivery, Unreadable to count every attempt,
Accepted to be 1, and Exhausted and Refused to be 0. Sending one more than the bound catches
a slot that an unreadable message never gives back. How to send them is in the adapter's fixture:
Run the conformance suite.
To find them in a running system, see Find the messages it could not read.