public interface OffsetStorageReader
OffsetStorageReader provides access to the offset storage used by sources. This can be used by connectors to determine offsets to start consuming data from. This is most commonly used during initialization of a task, but can also be used during runtime, e.g. when reconfiguring a task.
Offsets are always defined as Maps of Strings to primitive types, i.e. all types supported by
Schema other than Array, Map, and Struct.
|Modifier and Type||Method||Description|
Get the offset for the specified partition.
Get a set of offsets for the specified partition identifiers.
<T> java.util.Map<java.lang.String,java.lang.Object> offset(java.util.Map<java.lang.String,T> partition)
partition- object uniquely identifying the partition of data
<T> java.util.Map<java.util.Map<java.lang.String,T>,java.util.Map<java.lang.String,java.lang.Object>> offsets(java.util.Collection<java.util.Map<java.lang.String,T>> partitions)
Get a set of offsets for the specified partition identifiers. This may be more efficient
Note that when errors occur, this method omits the associated data and tries to return as many of the requested values as possible. This allows a task that's managing many partitions to still proceed with any available data. Therefore, implementations should take care to check that the data is actually available in the returned response. The only case when an exception will be thrown is if the entire request failed, e.g. because the underlying storage was unavailable.
partitions- set of identifiers for partitions of data