Class ExampleNativeSourceData
java.lang.Object
io.aiven.commons.kafka.connector.source.NativeSourceData<String>
io.aiven.commons.kafka.connector.source.impl.ExampleNativeSourceData
- All Implemented Interfaces:
AutoCloseable
An actual NativeSourceData implementation would use a NativeClient to retrieve the NativeItems.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.aiven.commons.kafka.connector.source.NativeSourceData
NativeSourceData.KeySerde<K> -
Constructor Summary
ConstructorsConstructorDescriptionExampleNativeSourceData(SourceCommonConfig sourceConfig, OffsetManager offsetManager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected OffsetManager.OffsetManagerEntrycreateOffsetManagerEntry(Context context) Creates an offset manager entry from a context.createOffsetManagerEntry(Map<String, Object> data) Creates an offset manager entry using the data in the map.getNativeItemIterator(String offset) Get an iterator of Native objects from the underlying storage layer.protected Optional<NativeSourceData.KeySerde<String>>Returns a KeySerde for the native keys.protected OffsetManager.OffsetManagerKeygetOffsetManagerKey(String nativeKey) Creates an offset manager key for the native key.Gets the name for the source type.Methods inherited from class io.aiven.commons.kafka.connector.source.NativeSourceData
close
-
Constructor Details
-
ExampleNativeSourceData
public ExampleNativeSourceData(SourceCommonConfig sourceConfig, OffsetManager offsetManager) throws IOException Constructor.- Parameters:
sourceConfig- the configuration.offsetManager- the Kafka offset manager- Throws:
IOException- on IO Error.
-
-
Method Details
-
getSourceName
Description copied from class:NativeSourceDataGets the name for the source type.- Specified by:
getSourceNamein classNativeSourceData<String>- Returns:
- the common name for the data source. For example "AWS S3 Storage" or "AMQP Stream source".
-
createOffsetManagerEntry
Description copied from class:NativeSourceDataCreates an offset manager entry using the data in the map.- Specified by:
createOffsetManagerEntryin classNativeSourceData<String>- Parameters:
data- the data to create the offset manager from.- Returns:
- a valid offset manager entry.
-
createOffsetManagerEntry
Description copied from class:NativeSourceDataCreates an offset manager entry from a context. The OffsetManagerEntry implementation must meet the contract:K key = ... OffsetManagerEntry entry = createOffsetManagerEntry(context); OffsetManagerEntry entry2 = createOffsetManagerEntry(entry1.getProperties()); entry2.getProperties() is element for element equal to entry1.getProperties() also OffsetManagerKey k = entry.getManagerKey() OffsetManagerKey k2 = entry2.getManagerKey() k2.getPartitionMap() is element for element equal to k.getPartitionMap()- Specified by:
createOffsetManagerEntryin classNativeSourceData<String>- Parameters:
context- the context to create the offset manager from.- Returns:
- a valid offset manager.
-
getNativeKeySerde
Description copied from class:NativeSourceDataReturns a KeySerde for the native keys. If native key serialization to String is not supported the method must return an empty Optional.- Specified by:
getNativeKeySerdein classNativeSourceData<String>- Returns:
- an Optional KeySerde for this system.
-
getOffsetManagerKey
Description copied from class:NativeSourceDataCreates an offset manager key for the native key. The OffsetManagerKey implementation must meet the contract:K key = ... OffsetManagerKey k = getOffsetManagerKey(key); OffsetManagerKey k2 = getOffsetManagerKey(key); k2.partitionMap() is element for element equal to k.partitionMap()- Specified by:
getOffsetManagerKeyin classNativeSourceData<String>- Parameters:
nativeKey- THe native key to create an offset manager key for.- Returns:
- An offset manager key.
-
getNativeItemIterator
Description copied from class:NativeSourceDataGet an iterator of Native objects from the underlying storage layer. The implementation must return the native objects in a repeatable order based on the key. In addition, the underlying storage must be able to start from a specific previously returned key.- Specified by:
getNativeItemIteratorin classNativeSourceData<String>- Parameters:
offset- the native key to start from. May benullot indicate start at the beginning.- Returns:
- An iterator of native objects. May be empty but not
null.
-