Interface ConsumerAwareMessageListener<K,V>
-
- Type Parameters:
K
- the key type.V
- the value type.
- All Superinterfaces:
GenericMessageListener<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>
,MessageListener<K,V>
- 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 ConsumerAwareMessageListener<K,V> extends MessageListener<K,V>
Listener for handling individual incoming Kafka messages.- Since:
- 2.0
- Author:
- Gary Russell
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data)
Invoked with data from kafka.void
onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Invoked with data from kafka and provides access to theConsumer
.-
Methods inherited from interface org.springframework.kafka.listener.GenericMessageListener
onMessage, onMessage
-
-
-
-
Method Detail
-
onMessage
default void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data)
Invoked with data from kafka. Containers should never call this since it they will detect we are a consumer aware acknowledging listener.- Specified by:
onMessage
in interfaceGenericMessageListener<K>
- Parameters:
data
- the data to be processed.
-
onMessage
void onMessage(org.apache.kafka.clients.consumer.ConsumerRecord<K,V> data, org.apache.kafka.clients.consumer.Consumer<?,?> consumer)
Description copied from interface:GenericMessageListener
Invoked with data from kafka and provides access to theConsumer
. The default implementation throwsUnsupportedOperationException
.- Specified by:
onMessage
in interfaceGenericMessageListener<K>
- Parameters:
data
- the data to be processed.consumer
- the consumer.
-
-