org.springframework.integration.kafka.listener
Class AbstractDecodingAcknowledgingMessageListener<K,P>

java.lang.Object
  extended by org.springframework.integration.kafka.listener.AbstractDecodingAcknowledgingMessageListener<K,P>
All Implemented Interfaces:
AcknowledgingMessageListener

public abstract class AbstractDecodingAcknowledgingMessageListener<K,P>
extends java.lang.Object
implements AcknowledgingMessageListener

Base AcknowledgingMessageListener implementation that decodes the key and the payload using the supplied Decoders. Users of this class must extend it and implement doOnMessage and must supply Decoder implementations for both the key and the payload.

Since:
1.0.1

Constructor Summary
AbstractDecodingAcknowledgingMessageListener(kafka.serializer.Decoder<K> keyDecoder, kafka.serializer.Decoder<P> payloadDecoder)
           
 
Method Summary
abstract  void doOnMessage(K key, P payload, KafkaMessageMetadata metadata, Acknowledgment acknowledgment)
          Process the decoded message
 void onMessage(KafkaMessage message, Acknowledgment acknowledgment)
          Executes when a Kafka message is received
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDecodingAcknowledgingMessageListener

public AbstractDecodingAcknowledgingMessageListener(kafka.serializer.Decoder<K> keyDecoder,
                                                    kafka.serializer.Decoder<P> payloadDecoder)
Method Detail

onMessage

public final void onMessage(KafkaMessage message,
                            Acknowledgment acknowledgment)
Description copied from interface: AcknowledgingMessageListener
Executes when a Kafka message is received

Specified by:
onMessage in interface AcknowledgingMessageListener
Parameters:
message - the Kafka message to be processed
acknowledgment - a handle for acknowledging the message processing

doOnMessage

public abstract void doOnMessage(K key,
                                 P payload,
                                 KafkaMessageMetadata metadata,
                                 Acknowledgment acknowledgment)
Process the decoded message

Parameters:
key - the message key
payload - the message body
metadata - the KafkaMessageMetadata
acknowledgment - the acknowledgment handle