@@ -143,7 +143,7 @@ class KafkaProducer(object):
143143 Compression is of full batches of data, so the efficacy of batching
144144 will also impact the compression ratio (more batching means better
145145 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
147147 to resend any record whose send fails with a potentially transient
148148 error. Note that this retry is no different than if the client
149149 resent the record upon receiving the error. Allowing retries
@@ -156,7 +156,7 @@ class KafkaProducer(object):
156156 configured by delivery_timeout_ms expires first before successful
157157 acknowledgement. Users should generally prefer to leave this config
158158 unset and instead use delivery_timeout_ms to control retry behavior.
159- Default: 2147483647 (java max int).
159+ Default: float('inf') (infinite)
160160 batch_size (int): Requests sent to brokers will contain multiple
161161 batches, one for each partition with data available to be sent.
162162 A small batch size will make batching less common and may reduce
@@ -337,7 +337,7 @@ class KafkaProducer(object):
337337 'acks' : 1 ,
338338 'bootstrap_topics_filter' : set (),
339339 'compression_type' : None ,
340- 'retries' : 2147483647 ,
340+ 'retries' : float ( 'inf' ) ,
341341 'batch_size' : 16384 ,
342342 'linger_ms' : 0 ,
343343 'partitioner' : DefaultPartitioner (),
@@ -485,10 +485,7 @@ def __init__(self, **configs):
485485 else :
486486 log .info ("%s: Instantiated an idempotent producer." , str (self ))
487487
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 :
492489 raise Errors .KafkaConfigurationError ("Must set 'retries' to non-zero when using the idempotent producer." )
493490
494491 if 'max_in_flight_requests_per_connection' not in user_provided_configs :
0 commit comments