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
ContainerProperties.ShareAckMode:
- MANUAL: The acknowledgment is non-null; the listener must call
ShareAcknowledgment.acknowledge(),ShareAcknowledgment.release(), orShareAcknowledgment.reject()for every record - EXPLICIT: The acknowledgment is null; the container sends ACCEPT
automatically on success and delegates errors to the
ShareConsumerRecordRecoverer - IMPLICIT: The acknowledgment is null; the broker auto-accepts all records
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 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.