Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-4911

Add ProducerRecord to ProducerInterceptor#onAcknowledgement

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.10.2.0
    • None
    • clients, producer
    • None

    Description

      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:

          ProducerRecord record = ...;
          producer.send(record, new Callback() {
            @Override
            public void onCompletion(RecordMetadata recordMetadata, Exception e) {
              // do something with record
            }
          })
      

      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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            kevinconaway Kevin Conaway
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: