InputT
- The type of the sink's inputWriterStateT
- The type of the sink writer's state@PublicEvolving public interface StatefulSink<InputT,WriterStateT> extends Sink<InputT>
Sink
with a stateful SinkWriter
.
The StatefulSink
needs to be serializable. All configuration should be validated
eagerly. The respective sink writers are transient and will only be created in the subtasks on
the taskmanagers.
Modifier and Type | Interface and Description |
---|---|
static interface |
StatefulSink.StatefulSinkWriter<InputT,WriterStateT>
A
SinkWriter whose state needs to be checkpointed. |
static interface |
StatefulSink.WithCompatibleState
A mix-in for
StatefulSink that allows users to migrate from a sink with a compatible
state to this sink. |
Sink.InitContext
Modifier and Type | Method and Description |
---|---|
StatefulSink.StatefulSinkWriter<InputT,WriterStateT> |
createWriter(Sink.InitContext context)
Create a
StatefulSink.StatefulSinkWriter . |
SimpleVersionedSerializer<WriterStateT> |
getWriterStateSerializer()
Any stateful sink needs to provide this state serializer and implement
StatefulSink.StatefulSinkWriter.snapshotState(long) properly. |
StatefulSink.StatefulSinkWriter<InputT,WriterStateT> |
restoreWriter(Sink.InitContext context,
Collection<WriterStateT> recoveredState)
Create a
StatefulSink.StatefulSinkWriter from a recovered state. |
StatefulSink.StatefulSinkWriter<InputT,WriterStateT> createWriter(Sink.InitContext context) throws IOException
StatefulSink.StatefulSinkWriter
.createWriter
in interface Sink<InputT>
context
- the runtime context.IOException
- for any failure during creation.StatefulSink.StatefulSinkWriter<InputT,WriterStateT> restoreWriter(Sink.InitContext context, Collection<WriterStateT> recoveredState) throws IOException
StatefulSink.StatefulSinkWriter
from a recovered state.context
- the runtime context.IOException
- for any failure during creation.SimpleVersionedSerializer<WriterStateT> getWriterStateSerializer()
StatefulSink.StatefulSinkWriter.snapshotState(long)
properly. The respective state is used in #restoreWriter(InitContext, Collection)
on recovery.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.