Kevin Conaway created KAFKA-4911:
------------------------------------
Summary: Add ProducerRecord to
ProducerInterceptor#onAcknowledgement
Key: KAFKA-4911
URL: https://issues.apache.org/jira/browse/KAFKA-4911
Project: Kafka
Issue Type: Improvement
Components: clients, producer
Affects Versions: 0.10.2.0
Reporter: Kevin Conaway
[~apovzner] I'd like to propose adding the {{ProducerRecord}} field to the
{{onAcknowledgement}} callback in the {{ProducerInterceptor}} interface that
was added in KAFKA-3162
The issue I'm having is that its not possible to determine if a specific record
was sent (based on the record content or key), only that _some_ record was sent
based on the {{RecordMetadata}}.
>From reading the KIP and the initial mailing list discussion, it seems that
>the design was modeled after the existing {{Producer.Callback}} interface.
>This model makes sense given that callbacks are typically anonymous functions
>where you would have access to the producer record:
{code:java}
ProducerRecord record = ...;
producer.send(record, new Callback() {
@Override
public void onCompletion(RecordMetadata recordMetadata, Exception e) {
// do something with record
}
})
{code}
However, based on my understanding of the interceptor design, the interceptor
should be thread safe and thus stateless. Even if you wanted to make it
stateful, its not easy to tie together a record from {{onSend}} to
{{onAcknowledgement}}
With that in mind, is there a way that the producer interceptor API can be
modified so that implementers can be aware of the key & content of the record
that was acknowledged?
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)