Skip to content

Commit 33df5c6

Browse files
authored
MINOR: clarify message ordering with max in-flight requests and idempotent producer (#10690)
The docs for the max.in.flight.requests.per.connection and enable.idempotence configs currently imply that setting the max in-flight request greater than 1 will break the message ordering guarantee, but that is only true if enable.idempotence is false. When using an idempotent producer, the max in-flight request can be up to 5 without re-ordering messages. Reviewers: Matthias J. Sax <[email protected]>, Ismael Juma <[email protected]>, Luke Chen <[email protected]>
1 parent c92e62a commit 33df5c6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ public class ProducerConfig extends AbstractConfig {
200200
/** <code>max.in.flight.requests.per.connection</code> */
201201
public static final String MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION = "max.in.flight.requests.per.connection";
202202
private static final String MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION_DOC = "The maximum number of unacknowledged requests the client will send on a single connection before blocking."
203-
+ " Note that if this setting is set to be greater than 1 and there are failed sends, there is a risk of"
204-
+ " message re-ordering due to retries (i.e., if retries are enabled).";
203+
+ " Note that if this config is set to be greater than 1 and <code>enable.idempotence</code> is set to false, there is a risk of"
204+
+ " message re-ordering after a failed send due to retries (i.e., if retries are enabled).";
205205

206206
/** <code>retries</code> */
207207
public static final String RETRIES_CONFIG = CommonClientConfigs.RETRIES_CONFIG;
@@ -246,10 +246,10 @@ public class ProducerConfig extends AbstractConfig {
246246
public static final String ENABLE_IDEMPOTENCE_CONFIG = "enable.idempotence";
247247
public static final String ENABLE_IDEMPOTENCE_DOC = "When set to 'true', the producer will ensure that exactly one copy of each message is written in the stream. If 'false', producer "
248248
+ "retries due to broker failures, etc., may write duplicates of the retried message in the stream. "
249-
+ "Note that enabling idempotence requires <code>" + MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION + "</code> to be less than or equal to 5, "
250-
+ "<code>" + RETRIES_CONFIG + "</code> to be greater than 0 and <code>" + ACKS_CONFIG + "</code> must be 'all'. If these values "
251-
+ "are not explicitly set by the user, suitable values will be chosen. If incompatible values are set, "
252-
+ "a <code>ConfigException</code> will be thrown.";
249+
+ "Note that enabling idempotence requires <code>" + MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION + "</code> to be less than or equal to 5 "
250+
+ "(with message ordering preserved for any allowable value), <code>" + RETRIES_CONFIG + "</code> to be greater than 0, and <code>"
251+
+ ACKS_CONFIG + "</code> must be 'all'. If these values are not explicitly set by the user, suitable values will be chosen. If incompatible "
252+
+ "values are set, a <code>ConfigException</code> will be thrown.";
253253

254254
/** <code> transaction.timeout.ms </code> */
255255
public static final String TRANSACTION_TIMEOUT_CONFIG = "transaction.timeout.ms";

0 commit comments

Comments
 (0)