java.lang.Object
io.aiven.commons.kafka.connector.source.task.Context

public class Context extends Object
A Context which captures all the details about the source object that are required to successfully send a source record onto Kafka
  • Constructor Details

    • Context

      public Context(Comparable<?> nativeKey)
      Constructor.
      Parameters:
      nativeKey - The native key for the object being processed.
    • Context

      protected Context(Context anotherContext)
      Creates a defensive copy of the Context
      Parameters:
      anotherContext - The Context which needs to be copied
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTopic

      public final Optional<String> getTopic()
      Gets the Kafka topic as specified by the context.
      Returns:
      an Optional kafka topic.
    • setTopic

      public final void setTopic(String topic)
      Sets the Kafka topic for this context.
      Parameters:
      topic - the topic. May be null.
    • getPartition

      public final Optional<Integer> getPartition()
      Gets the Kafka partition as specified by the context.
      Returns:
      an Optional kafka partition.
    • setPartition

      public final void setPartition(Integer partition)
      Sets the Kafka partition for this context.
      Parameters:
      partition - the partition. May be null.
    • getNativeKey

      public final <T extends Comparable<T>> T getNativeKey()
      Get the native key as specified by this context.
      Type Parameters:
      T - the returned native key type.
      Returns:
      the Optional storage key for the native object this context is associated with.
    • getOffset

      public final Optional<Long> getOffset()
      Gets the native offset for this context. When used as a Context within a larger context, this is the number of bytes into the native stream that this context starts at.
      Returns:
      an optional native offset for this context.
    • setOffset

      public final void setOffset(Long offset)
      Sets the native offset for this context. When used as a Context within a larger context, this is the number of bytes into the native stream that this context starts at.
      Parameters:
      offset - the optional native offset for this context. May be null.