JohnD
JohnD

Reputation: 465

Kafka how to set producer retries to Infinity

How can I set the spring-boot property : spring.kafka.producer.retries to Integer.MAX_VALUE ?

Is it working to unset this property or this will default to 0 ?

@See default kafka in KIP https://cwiki.apache.org/confluence/display/KAFKA/KIP-98+-+Exactly+Once+Delivery+and+Transactional+Messaging

Upvotes: 4

Views: 9904

Answers (3)

Ryuzaki L
Ryuzaki L

Reputation: 40088

By default it is 2147483647 which is Integer.MAX_VALUE you can set between [0,...,2147483647]

retries docs

Setting a value greater than zero will cause the client to resend any record whose send fails with a potentially transient error. Note that this retry is no different than if the client resent the record upon receiving the error. Allowing retries without setting max.in.flight.requests.per.connection to 1 will potentially change the ordering of records because if two batches are sent to a single partition, and the first fails and is retried but the second succeeds, then the records in the second batch may appear first. Note additionally that produce requests will be failed before the number of retries has been exhausted if the timeout configured by delivery.timeout.ms expires first before successful acknowledgement. Users should generally prefer to leave this config unset and instead use 1delivery.timeout.ms1 to control retry behavior.

Upvotes: 2

Pavan Ravula
Pavan Ravula

Reputation: 49

Default value of ProducerConfig.RETRIES_CONFIG is 2147483647. Hope not defining the retries property will take care default value

Upvotes: 2

Gary Russell
Gary Russell

Reputation: 174799

According to the Kafka docs it defaults to Integer.MAX_VALUE (at least with the current version), which concurs with the KIP.

Upvotes: 5

Related Questions