简体   繁体   中英

Kafka message ordering in partition while producer retry

According to producer configs, there are: retries and max.in.flight.requests.per.connection . Suppose that retries > 0 and max.in.flight.requests.per.connection > 1.

Can messages arrive out of order within ONE partition of topic (eg if first message has retries, but second message delivered to broker with the first attempt)?

Or do out of order only happen across several partitions of topic, but within partition order is preserved?

If you set retries to more than 0 and max.in.flight.requests.per.connection to more than 1, then yes messages can arrive out of order on the broker even if they are for the same partition.

You can also have duplicates if for example a message is correctly added to the Kafka logs and an error happens when sending the response back to the client.

Since Kafka 0.11, you can use the Idempotent producer to solve these 2 issues. See http://kafka.apache.org/documentation/#semantics

根据最新的更新文档,您最多可以有 5 个max.in.flight.requests.per.connection并且 Kafka 可以为此维护订单。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM