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

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

public abstract class AbstractDecodingMessageListener<K,P>
extends java.lang.Object
implements MessageListener

Base MessageListener 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.


Constructor Summary
AbstractDecodingMessageListener(kafka.serializer.Decoder<K> keyDecoder, kafka.serializer.Decoder<P> payloadDecoder)
           
 
Method Summary
abstract  void doOnMessage(K key, P payload, KafkaMessageMetadata metadata)
          Process the decoded message
 void onMessage(KafkaMessage message)
          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

AbstractDecodingMessageListener

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

onMessage

public final void onMessage(KafkaMessage message)
Description copied from interface: MessageListener
Executes when a Kafka message is received

Specified by:
onMessage in interface MessageListener
Parameters:
message - the Kafka message to be processed

doOnMessage

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

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