Skip to main content

Re: How it is safe to break message ordering but not idempotency after getting an OutOfOrderSequenceException?

Yes, the broker de-dupes using the sequence number.

But for example, if a sequence number is skipped, you could get this
exception: the current batch of messages cannot be appended to the log,
as one batch is missing, and the producer would need to re-send the
previous/missing batch with lower sequence number before it can move to
the "next" (ie current) batch.

Does this make sense?


-Matthias

On 5/27/22 10:43 AM, Gabriel Giussi wrote:
> The docs say
> "This exception indicates that the broker received an unexpected sequence
> number from the producer, which means that data may have been lost. If the
> producer is configured for idempotence only (i.e. if enable.idempotence is
> set and no transactional.id is configured), it is possible to continue
> sending with the same producer instance, but doing so risks reordering of
> sent record"
>
> Isn't the broker using the monotonically increasing sequence number to
> dedup messages? So how can it break message ordering without breaking
> idempotency?
> I can't see an example scenario where this could happen, I guess
> the OutOfOrderSequenceException can only happen
> with max.in.flight.requests.per.connection > 1, but even in that case why
> are not going to keep getting an OutOfOrderSequenceException but instead a
> success that broke message ordering?
>
> Thanks.
>

Comments