Interface AcknowledgingShareConsumerAwareMessageListener<K,V>

Type Parameters:
K - the key type
V - the value type
All Superinterfaces:
GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
All Known Implementing Classes:
ShareRecordMessagingMessageListenerAdapter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface AcknowledgingShareConsumerAwareMessageListener<K,V> extends GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
A message listener for share consumer containers with acknowledgment support.

This interface provides access to both the ShareConsumer instance and acknowledgment capabilities. The acknowledgment parameter behavior depends on the container's ContainerProperties.ShareAckMode:

This is the primary listener interface for share consumers when you need access to the ShareConsumer instance or need listener-managed acknowledgment control (ShareAckMode.MANUAL).

Since:
4.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data)
    Invoked with data from kafka.
    void
    onShareRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, @Nullable ShareAcknowledgment acknowledgment, org.apache.kafka.clients.consumer.ShareConsumer<?,?> consumer)
    Invoked with data from Kafka, an acknowledgment, and provides access to the consumer.

    Methods inherited from interface GenericMessageListener

    onMessage, onMessage, onMessage
  • Method Details

    • onShareRecord

      void onShareRecord(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, @Nullable ShareAcknowledgment acknowledgment, org.apache.kafka.clients.consumer.ShareConsumer<?,?> consumer)
      Invoked with data from Kafka, an acknowledgment, and provides access to the consumer. The acknowledgment is non-null only in ContainerProperties.ShareAckMode.MANUAL mode; it is null in EXPLICIT and IMPLICIT modes.
      Parameters:
      data - the data to be processed.
      acknowledgment - the acknowledgment, or null if not in MANUAL mode.
      consumer - the consumer.
    • onMessage

      default void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data)
      Description copied from interface: GenericMessageListener
      Invoked with data from kafka.
      Specified by:
      onMessage in interface GenericMessageListener<K>
      Parameters:
      data - the data to be processed.