Skip to content

Commit 9b31ee5

Browse files
Merge pull request #266 from j3-signalroom/265-add-some-best-practice-kafka-producer-configuration-settings
Resolved #265.
2 parents 9640d3f + 087f86b commit 9b31ee5

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The format is base on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
1010
- Issue [#241](https://github.com/j3-signalroom/kafka_cluster-topics-partition_count_recommender-tool/issues/241)
1111
- Issue [#246](https://github.com/j3-signalroom/kafka_cluster-topics-partition_count_recommender-tool/issues/246)
1212
- Issue [#248](https://github.com/j3-signalroom/kafka_cluster-topics-partition_count_recommender-tool/issues/248)
13+
- Issue [#265](https://github.com/j3-signalroom/kafka_cluster-topics-partition_count_recommender-tool/issues/265)
1314

1415
### Changed
1516
- Issue [#247](https://github.com/j3-signalroom/kafka_cluster-topics-partition_count_recommender-tool/issues/247)

CHANGELOG.pdf

459 Bytes
Binary file not shown.

src/thread_safe_kafka_writer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,13 @@ def __init__(self,
204204
"sasl.mechanism": "PLAIN",
205205
"sasl.username": sasl_username,
206206
"sasl.password": sasl_password,
207-
"linger.ms": 100, # Batch messages for efficiency
207+
"linger.ms": 100, # Batch messages for efficiency
208208
"compression.type": "lz4",
209-
"acks": "all", # Wait for all replicas
210-
"retries": 3
209+
"acks": "all", # Wait for all replicas
210+
"retries": 10,
211+
'retry.backoff.ms': 100,
212+
'delivery.timeout.ms': 300000, # Delivery timeout 5 minutes
213+
'enable.idempotence': True, # Prevents duplicate messages on retry
211214
})
212215
except Exception as e:
213216
logging.error(f"Failed to create Kafka producer: {e}")

0 commit comments

Comments
 (0)