public class WindowingOffsetManager
extends java.lang.Object
implements org.springframework.integration.kafka.listener.OffsetManager, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
OffsetManager
that aggregates writes over a time or count window, using an underlying delegate to
do the actual operations. Its purpose is to reduce the performance impact of writing operations
wherever this is desirable.
Either a time window or a number of writes can be specified, but not both.Constructor and Description |
---|
WindowingOffsetManager(org.springframework.integration.kafka.listener.OffsetManager offsetManager) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
close() |
void |
deleteOffset(org.springframework.integration.kafka.core.Partition partition) |
void |
destroy() |
void |
flush() |
long |
getOffset(org.springframework.integration.kafka.core.Partition partition) |
void |
resetOffsets(java.util.Collection<org.springframework.integration.kafka.core.Partition> partition) |
void |
setCount(int count)
How many writes should be aggregated, before invoking the underlying
OffsetManager . |
void |
setShutdownTimeout(int shutdownTimeout)
|
void |
setTimespan(long timespan)
The timespan for aggregating write operations, before invoking the underlying
OffsetManager . |
void |
updateOffset(org.springframework.integration.kafka.core.Partition partition,
long offset) |
public WindowingOffsetManager(org.springframework.integration.kafka.listener.OffsetManager offsetManager)
public void setTimespan(long timespan)
OffsetManager
.timespan
- duration in millisecondspublic void setCount(int count)
OffsetManager
. Setting this value
to 1 effectively disables windowing.count
- number of writespublic void setShutdownTimeout(int shutdownTimeout)
close()
and destroy()
operations will wait for receving a confirmation that the
underlying writes have been processed.shutdownTimeout
- duration in millisecondspublic void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void destroy() throws java.lang.Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
java.lang.Exception
public void updateOffset(org.springframework.integration.kafka.core.Partition partition, long offset)
updateOffset
in interface org.springframework.integration.kafka.listener.OffsetManager
public long getOffset(org.springframework.integration.kafka.core.Partition partition)
getOffset
in interface org.springframework.integration.kafka.listener.OffsetManager
public void deleteOffset(org.springframework.integration.kafka.core.Partition partition)
deleteOffset
in interface org.springframework.integration.kafka.listener.OffsetManager
public void resetOffsets(java.util.Collection<org.springframework.integration.kafka.core.Partition> partition)
resetOffsets
in interface org.springframework.integration.kafka.listener.OffsetManager
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException