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

public class ExampleNativeSourceData extends NativeSourceData<String>
An actual NativeSourceData implementation would use a NativeClient to retrieve the NativeItems.
  • 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

      public String getSourceName()
      Description copied from class: NativeSourceData
      Gets the name for the source type.
      Specified by:
      getSourceName in class NativeSourceData<String>
      Returns:
      the common name for the data source. For example "AWS S3 Storage" or "AMQP Stream source".
    • createOffsetManagerEntry

      public OffsetManager.OffsetManagerEntry createOffsetManagerEntry(Map<String,Object> data)
      Description copied from class: NativeSourceData
      Creates an offset manager entry using the data in the map.
      Specified by:
      createOffsetManagerEntry in class NativeSourceData<String>
      Parameters:
      data - the data to create the offset manager from.
      Returns:
      a valid offset manager entry.
    • createOffsetManagerEntry

      protected OffsetManager.OffsetManagerEntry createOffsetManagerEntry(Context context)
      Description copied from class: NativeSourceData
      Creates 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:
      createOffsetManagerEntry in class NativeSourceData<String>
      Parameters:
      context - the context to create the offset manager from.
      Returns:
      a valid offset manager.
    • getNativeKeySerde

      protected Optional<NativeSourceData.KeySerde<String>> getNativeKeySerde()
      Description copied from class: NativeSourceData
      Returns a KeySerde for the native keys. If native key serialization to String is not supported the method must return an empty Optional.
      Specified by:
      getNativeKeySerde in class NativeSourceData<String>
      Returns:
      an Optional KeySerde for this system.
    • getOffsetManagerKey

      protected OffsetManager.OffsetManagerKey getOffsetManagerKey(String nativeKey)
      Description copied from class: NativeSourceData
      Creates 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:
      getOffsetManagerKey in class NativeSourceData<String>
      Parameters:
      nativeKey - THe native key to create an offset manager key for.
      Returns:
      An offset manager key.
    • getNativeItemIterator

      public Iterator<ExampleSourceNativeInfo> getNativeItemIterator(String offset)
      Description copied from class: NativeSourceData
      Get 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:
      getNativeItemIterator in class NativeSourceData<String>
      Parameters:
      offset - the native key to start from. May be null ot indicate start at the beginning.
      Returns:
      An iterator of native objects. May be empty but not null.