Class Context
java.lang.Object
io.aiven.commons.kafka.connector.source.task.Context
A Context which captures all the details about the source object that are required to
successfully send a source record onto Kafka
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a defensive copy of the ContextContext(Comparable<?> nativeKey) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal <T extends Comparable<T>>
TGet the native key as specified by this context.Gets the native offset for this context.Gets the Kafka partition as specified by the context.getTopic()Gets the Kafka topic as specified by the context.final voidSets the native offset for this context.final voidsetPartition(Integer partition) Sets the Kafka partition for this context.final voidSets the Kafka topic for this context.toString()
-
Constructor Details
-
Context
Constructor.- Parameters:
nativeKey- The native key for the object being processed.
-
Context
Creates a defensive copy of the Context- Parameters:
anotherContext- The Context which needs to be copied
-
-
Method Details
-
toString
-
getTopic
Gets the Kafka topic as specified by the context.- Returns:
- an Optional kafka topic.
-
setTopic
Sets the Kafka topic for this context.- Parameters:
topic- the topic. May benull.
-
getPartition
Gets the Kafka partition as specified by the context.- Returns:
- an Optional kafka partition.
-
setPartition
Sets the Kafka partition for this context.- Parameters:
partition- the partition. May benull.
-
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
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
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 benull.
-