@PublicEvolving public static interface Sink.InitContext
SinkWriter
.Modifier and Type | Field and Description |
---|---|
static long |
INITIAL_CHECKPOINT_ID
The first checkpoint id when an application is started and not recovered from a
previously taken checkpoint or savepoint.
|
Modifier and Type | Method and Description |
---|---|
SerializationSchema.InitializationContext |
asSerializationSchemaInitializationContext()
Provides a view on this context as a
SerializationSchema.InitializationContext . |
<IN> TypeSerializer<IN> |
createInputSerializer()
Creates a serializer for the type of sink's input.
|
int |
getAttemptNumber()
Gets the attempt number of this parallel subtask.
|
JobID |
getJobId()
The ID of the current job.
|
MailboxExecutor |
getMailboxExecutor()
Returns the mailbox executor that allows to execute
Runnable s inside the task
thread in between record processing. |
int |
getNumberOfParallelSubtasks() |
ProcessingTimeService |
getProcessingTimeService()
Returns a
ProcessingTimeService that can be used to get the current time and
register timers. |
OptionalLong |
getRestoredCheckpointId()
Returns id of the restored checkpoint, if state was restored from the snapshot of a
previous execution.
|
int |
getSubtaskId() |
UserCodeClassLoader |
getUserCodeClassLoader()
Gets the
UserCodeClassLoader to load classes that are not in system's classpath,
but are part of the jar file of a user job. |
boolean |
isObjectReuseEnabled()
Returns whether object reuse has been enabled or disabled.
|
default <MetaT> Optional<Consumer<MetaT>> |
metadataConsumer()
Returns a metadata consumer, the
SinkWriter can publish metadata events of type
MetaT to the consumer. |
SinkWriterMetricGroup |
metricGroup() |
static final long INITIAL_CHECKPOINT_ID
UserCodeClassLoader getUserCodeClassLoader()
UserCodeClassLoader
to load classes that are not in system's classpath,
but are part of the jar file of a user job.UserCodeClassLoader
MailboxExecutor getMailboxExecutor()
Runnable
s inside the task
thread in between record processing.
Note that this method should not be used per-record for performance reasons in the
same way as records should not be sent to the external system individually. Rather,
implementers are expected to batch records and only enqueue a single Runnable
per
batch to handle the result.
ProcessingTimeService getProcessingTimeService()
ProcessingTimeService
that can be used to get the current time and
register timers.int getSubtaskId()
int getNumberOfParallelSubtasks()
int getAttemptNumber()
SinkWriterMetricGroup metricGroup()
OptionalLong getRestoredCheckpointId()
SerializationSchema.InitializationContext asSerializationSchemaInitializationContext()
SerializationSchema.InitializationContext
.boolean isObjectReuseEnabled()
<IN> TypeSerializer<IN> createInputSerializer()
JobID getJobId()
@Experimental default <MetaT> Optional<Consumer<MetaT>> metadataConsumer()
SinkWriter
can publish metadata events of type
MetaT
to the consumer.
It is recommended to use a separate thread pool to publish the metadata because
enqueuing a lot of these messages in the mailbox may lead to a performance decrease.
thread, and the Consumer.accept(T)
method is executed very fast.
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.