Interface ShareAcknowledgment


public interface ShareAcknowledgment
A handle for acknowledging the delivery of a record when using share groups.

Share groups enable cooperative consumption where multiple consumers can process records from the same partitions. Each record must be explicitly acknowledged to indicate the result of processing.

Acknowledgment types:

  • ACCEPT - Record processed successfully
  • RELEASE - Temporary failure, make available for retry
  • REJECT - Permanent failure, do not retry

This interface is only applicable when using explicit acknowledgment mode (share.acknowledgement.mode=explicit). In implicit mode, records are automatically acknowledged as ACCEPT.

Note: Acknowledgment is separate from commit operations. After acknowledging records, use commitSync() or commitAsync() to persist the acknowledgments to the broker.

Since:
4.0
Author:
Soby Chacko
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Acknowledge the record as successfully processed.
    void
    Reject the record due to a permanent failure.
    void
    Release the record for redelivery due to a transient failure.
  • Method Details

    • acknowledge

      void acknowledge()
      Acknowledge the record as successfully processed.

      The record will be marked as completed and will not be redelivered. The acknowledgment will be committed when:

      • The next poll() is called (batched with fetch)
      • commitSync() or commitAsync() is explicitly called
      • The consumer is closed
      Throws:
      IllegalStateException - if the record has already been acknowledged
      Since:
      4.0
    • release

      void release()
      Release the record for redelivery due to a transient failure.

      The record will be made available for another delivery attempt. The acknowledgment will be committed when:

      • The next poll() is called (batched with fetch)
      • commitSync() or commitAsync() is explicitly called
      • The consumer is closed
      Throws:
      IllegalStateException - if the record has already been acknowledged
    • reject

      void reject()
      Reject the record due to a permanent failure.

      The record will not be delivered again and will be archived. The acknowledgment will be committed when:

      • The next poll() is called (batched with fetch)
      • commitSync() or commitAsync() is explicitly called
      • The consumer is closed
      Throws:
      IllegalStateException - if the record has already been acknowledged