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.InitializingBeanjava.lang.Exceptionpublic void destroy()
throws java.lang.Exception
destroy in interface org.springframework.beans.factory.DisposableBeanjava.lang.Exceptionpublic void updateOffset(org.springframework.integration.kafka.core.Partition partition,
long offset)
updateOffset in interface org.springframework.integration.kafka.listener.OffsetManagerpublic long getOffset(org.springframework.integration.kafka.core.Partition partition)
getOffset in interface org.springframework.integration.kafka.listener.OffsetManagerpublic void deleteOffset(org.springframework.integration.kafka.core.Partition partition)
deleteOffset in interface org.springframework.integration.kafka.listener.OffsetManagerpublic void resetOffsets(java.util.Collection<org.springframework.integration.kafka.core.Partition> partition)
resetOffsets in interface org.springframework.integration.kafka.listener.OffsetManagerpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushablejava.io.IOException