org.springframework.integration.kafka.listener
Class MetadataStoreOffsetManager

java.lang.Object
  extended by org.springframework.integration.kafka.listener.AbstractOffsetManager
      extended by org.springframework.integration.kafka.listener.MetadataStoreOffsetManager
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, org.springframework.beans.factory.DisposableBean, OffsetManager

public class MetadataStoreOffsetManager
extends AbstractOffsetManager

An OffsetManager that persists offsets into a MetadataStore.


Field Summary
 
Fields inherited from class org.springframework.integration.kafka.listener.AbstractOffsetManager
connectionFactory, consumerId, initialOffsets, log, referenceTimestamp
 
Constructor Summary
MetadataStoreOffsetManager(ConnectionFactory connectionFactory)
           
MetadataStoreOffsetManager(ConnectionFactory connectionFactory, java.util.Map<Partition,java.lang.Long> initialOffsets)
           
 
Method Summary
 void close()
           
protected  java.lang.Long doGetOffset(Partition partition)
           
protected  void doRemoveOffset(Partition partition)
           
protected  void doUpdateOffset(Partition partition, long offset)
           
 void flush()
           
 java.lang.String generateKey(Partition partition)
           
 void setMetadataStore(org.springframework.integration.metadata.MetadataStore metadataStore)
          The backing MetadataStore for storing offsets.
 
Methods inherited from class org.springframework.integration.kafka.listener.AbstractOffsetManager
deleteOffset, destroy, getConsumerId, getOffset, resetOffsets, setConsumerId, setReferenceTimestamp, updateOffset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataStoreOffsetManager

public MetadataStoreOffsetManager(ConnectionFactory connectionFactory)

MetadataStoreOffsetManager

public MetadataStoreOffsetManager(ConnectionFactory connectionFactory,
                                  java.util.Map<Partition,java.lang.Long> initialOffsets)
Method Detail

setMetadataStore

public void setMetadataStore(org.springframework.integration.metadata.MetadataStore metadataStore)
The backing MetadataStore for storing offsets.

Parameters:
metadataStore - a fully configured MetadataStore instance

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException

doUpdateOffset

protected void doUpdateOffset(Partition partition,
                              long offset)
Specified by:
doUpdateOffset in class AbstractOffsetManager

doRemoveOffset

protected void doRemoveOffset(Partition partition)
Specified by:
doRemoveOffset in class AbstractOffsetManager

doGetOffset

protected java.lang.Long doGetOffset(Partition partition)
Specified by:
doGetOffset in class AbstractOffsetManager

generateKey

public java.lang.String generateKey(Partition partition)