@@ -143,7 +143,7 @@ class KafkaProducer(object):
143
143
Compression is of full batches of data, so the efficacy of batching
144
144
will also impact the compression ratio (more batching means better
145
145
compression). Default: None.
146
- retries (int ): Setting a value greater than zero will cause the client
146
+ retries (numeric ): Setting a value greater than zero will cause the client
147
147
to resend any record whose send fails with a potentially transient
148
148
error. Note that this retry is no different than if the client
149
149
resent the record upon receiving the error. Allowing retries
@@ -156,7 +156,7 @@ class KafkaProducer(object):
156
156
configured by delivery_timeout_ms expires first before successful
157
157
acknowledgement. Users should generally prefer to leave this config
158
158
unset and instead use delivery_timeout_ms to control retry behavior.
159
- Default: 2147483647 (java max int).
159
+ Default: float('inf') (infinite)
160
160
batch_size (int): Requests sent to brokers will contain multiple
161
161
batches, one for each partition with data available to be sent.
162
162
A small batch size will make batching less common and may reduce
@@ -337,7 +337,7 @@ class KafkaProducer(object):
337
337
'acks' : 1 ,
338
338
'bootstrap_topics_filter' : set (),
339
339
'compression_type' : None ,
340
- 'retries' : 2147483647 ,
340
+ 'retries' : float ( 'inf' ) ,
341
341
'batch_size' : 16384 ,
342
342
'linger_ms' : 0 ,
343
343
'partitioner' : DefaultPartitioner (),
@@ -485,10 +485,7 @@ def __init__(self, **configs):
485
485
else :
486
486
log .info ("%s: Instantiated an idempotent producer." , str (self ))
487
487
488
- if 'retries' not in user_provided_configs :
489
- log .info ("%s: Overriding the default 'retries' config to 3 since the idempotent producer is enabled." , str (self ))
490
- self .config ['retries' ] = 3
491
- elif self .config ['retries' ] == 0 :
488
+ if self .config ['retries' ] == 0 :
492
489
raise Errors .KafkaConfigurationError ("Must set 'retries' to non-zero when using the idempotent producer." )
493
490
494
491
if 'max_in_flight_requests_per_connection' not in user_provided_configs :
0 commit comments