Interface AcknowledgingShareConsumerAwareMessageListener<K,V>
- Type Parameters:
K- the key typeV- 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
acknowledgment mode:
- Explicit mode: The acknowledgment parameter is non-null and must be used to acknowledge each record
- Implicit mode: The acknowledgment parameter is null and records are automatically acknowledged
This is the primary listener interface for share consumers when you need access to the ShareConsumer instance or need explicit acknowledgment control.
- Since:
- 4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidInvoked with data from kafka.voidonShareRecord(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
-
onMessage
Description copied from interface:GenericMessageListenerInvoked with data from kafka.- Specified by:
onMessagein interfaceGenericMessageListener<K>- Parameters:
data- the data to be processed.