|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.integration.kafka.listener.AbstractOffsetManager
org.springframework.integration.kafka.listener.KafkaTopicOffsetManager
public class KafkaTopicOffsetManager
Implementation of an OffsetManager that uses a Kafka topic as the underlying support.
For its proper functioning, the Kafka server(s) must set log.cleaner.enable=true. It relies on the property
cleanup.policy=compact to be set on the target topic, and if the topic is not found,
it will create a topic with the appropriate settings.
| Nested Class Summary | |
|---|---|
static class |
KafkaTopicOffsetManager.Key
Wraps the partition and consumer information and will be used as a key on the Kafka topic |
static class |
KafkaTopicOffsetManager.KeyEncoderDecoder
|
| Field Summary | |
|---|---|
static java.lang.String |
CLEANUP_POLICY
|
static java.lang.String |
CLEANUP_POLICY_COMPACT
|
static java.lang.String |
DELETE_RETENTION
|
static java.lang.String |
SEGMENT_BYTES
|
| Fields inherited from class org.springframework.integration.kafka.listener.AbstractOffsetManager |
|---|
connectionFactory, consumerId, initialOffsets, log, referenceTimestamp |
| Constructor Summary | |
|---|---|
KafkaTopicOffsetManager(ZookeeperConnect zookeeperConnect,
java.lang.String topic)
|
|
KafkaTopicOffsetManager(ZookeeperConnect zookeeperConnect,
java.lang.String topic,
java.util.Map<Partition,java.lang.Long> initialOffsets)
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
void |
close()
|
protected java.lang.Long |
doGetOffset(Partition partition)
|
protected void |
doRemoveOffset(Partition partition)
|
protected void |
doUpdateOffset(Partition partition,
long offset)
|
void |
flush()
|
void |
setBatchWrites(boolean batchWrites)
Whether offset writes should be batched or not |
void |
setCompressionCodec(java.lang.String compressionCodec)
The compression codec for writing to the offset topic |
void |
setMaxBatchSize(int maxBatchSize)
The maximum batch size for offset writes |
void |
setMaxQueueBufferingTime(int maxQueueBufferingTime)
For how long will producers buffer data before writing to the topic |
void |
setMaxSize(int maxSize)
Sets the maximum size of a fetch request, allowing to tune the initialization process. |
void |
setReplicationFactor(int replicationFactor)
The replication factor of the offset topic |
void |
setRequiredAcks(int requiredAcks)
The number of required acks on write operations |
void |
setRetentionTime(int retentionTime)
How long are dead records retained in the offset topic |
void |
setSegmentSize(int segmentSize)
The size of a segment in the offset topic |
| 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 |
| Field Detail |
|---|
public static final java.lang.String CLEANUP_POLICY
public static final java.lang.String CLEANUP_POLICY_COMPACT
public static final java.lang.String DELETE_RETENTION
public static final java.lang.String SEGMENT_BYTES
| Constructor Detail |
|---|
public KafkaTopicOffsetManager(ZookeeperConnect zookeeperConnect,
java.lang.String topic)
public KafkaTopicOffsetManager(ZookeeperConnect zookeeperConnect,
java.lang.String topic,
java.util.Map<Partition,java.lang.Long> initialOffsets)
| Method Detail |
|---|
public void setMaxSize(int maxSize)
maxSize - the maximum amount of data to be brought on a fetchpublic void setCompressionCodec(java.lang.String compressionCodec)
compressionCodec - the compression codecpublic void setMaxQueueBufferingTime(int maxQueueBufferingTime)
maxQueueBufferingTime - the maximum buffering window (in milliseconds)public void setSegmentSize(int segmentSize)
segmentSize - the segment size of an offset topicpublic void setRetentionTime(int retentionTime)
retentionTime - the retention time for dead records (in seconds)public void setReplicationFactor(int replicationFactor)
replicationFactor - the replication factorpublic void setMaxBatchSize(int maxBatchSize)
maxBatchSize - maximum batching windowpublic void setBatchWrites(boolean batchWrites)
batchWrites - true if writes are batchedpublic void setRequiredAcks(int requiredAcks)
requiredAcks - the number of required acks
public void afterPropertiesSet()
throws java.lang.Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanjava.lang.Exception
protected void doUpdateOffset(Partition partition,
long offset)
doUpdateOffset in class AbstractOffsetManagerprotected void doRemoveOffset(Partition partition)
doRemoveOffset in class AbstractOffsetManagerprotected java.lang.Long doGetOffset(Partition partition)
doGetOffset in class AbstractOffsetManager
public void flush()
throws java.io.IOException
flush in interface java.io.Flushablejava.io.IOException
public void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||