InputT
- The type of the sink writer's inputCommT
- The type of information needed to commit data staged by the sinkWriterStateT
- The type of the writer's state@Experimental public interface SinkWriter<InputT,CommT,WriterStateT> extends AutoCloseable
SinkWriter
is responsible for writing data and handling any potential tmp area used
to write yet un-staged data, e.g. in-progress files. The data (or metadata pointing to where the
actual data is staged) ready to commit is returned to the system by the prepareCommit(boolean)
.Modifier and Type | Interface and Description |
---|---|
static interface |
SinkWriter.Context
Context that
write(InputT, org.apache.flink.api.connector.sink.SinkWriter.Context) can use for getting additional data about an input record. |
Modifier and Type | Method and Description |
---|---|
List<CommT> |
prepareCommit(boolean flush)
Prepare for a commit.
|
List<WriterStateT> |
snapshotState() |
void |
write(InputT element,
SinkWriter.Context context)
Add an element to the writer.
|
close
void write(InputT element, SinkWriter.Context context) throws IOException
element
- The input recordcontext
- The additional information about the input recordIOException
- if fail to add an element.List<CommT> prepareCommit(boolean flush) throws IOException
This will be called before we checkpoint the Writer's state in Streaming execution mode.
flush
- Whether flushing the un-staged data or notIOException
- if fail to prepare for a commit.List<WriterStateT> snapshotState() throws IOException
IOException
- if fail to snapshot writer's state.Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.