DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
KafkaProducer is designed to be thread-safe and we encourage users to share a single producer instance across multiple threads[link]. These threads often need to send records to different topics. However, another important configuration—acks—is currently set at the producer level only. As a result, users needing different acks settings for each topic must create additional producer instances instead of reusing the existing one. This goes against our original intent and prevents users from reusing KafkaProducer instance.
...
We add a new config TOPIC_ACKS_CONFIG and TOPIC_ACKS_DOC into ProducerConfig and define the format.
Format: acks.topic=acks.acks=<TopicA>.acks=<acks1>:acks.<TopicB>.acks=<acks2>
Name | Type | Importance | Default | Description |
|---|---|---|---|---|
| topic.acks | String | LOW | null | This configuration item will set acks for specific topics. |
Proposed Changes
- Adding a new configuration in ProducerConfig : topic.acks, By setting this configuration item, users can customize the acks for specific topic.
- Behavior change:
- Attach topic-level acks to RecordAccumulator#TopicInfo.
- Return Map<Acks, List<ProducerBatch>> when RecordAccumulator#drainBatchesForOneNode is called.
- Finally, we can get the acks information and group same acks into List<ProducerBatch>> for a node in sender#sendProduceRequests and then send request.
...
- The public interface is new one so there are no compatibility issues.
- The ProduceRequest already contains an acks field so we don't need add any additional change at PRC-level [link].
Test Plan
- Relevant unit tests and integration tests will be added to demonstrate the functionality.
...