Interface SinkWriter<InputT>
-
- Type Parameters:
InputT
- The type of the sink writer's input
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
CommittingSinkWriter<InputT,CommittableT>
,StatefulSinkWriter<InputT,WriterStateT>
- All Known Implementing Classes:
AsyncSinkWriter
,FileWriter
,PrintSinkOutputWriter
@Public public interface SinkWriter<InputT> extends AutoCloseable
TheSinkWriter
is responsible for writing data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SinkWriter.Context
Context thatwrite(InputT, org.apache.flink.api.connector.sink2.SinkWriter.Context)
can use for getting additional data about an input record.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
flush(boolean endOfInput)
Called on checkpoint or end of input so that the writer to flush all pending data for at-least-once.void
write(InputT element, SinkWriter.Context context)
Adds an element to the writer.default void
writeWatermark(Watermark watermark)
Adds a watermark to the writer.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
write
void write(InputT element, SinkWriter.Context context) throws IOException, InterruptedException
Adds an element to the writer.- Parameters:
element
- The input recordcontext
- The additional information about the input record- Throws:
IOException
- if fail to add an element.InterruptedException
-
flush
void flush(boolean endOfInput) throws IOException, InterruptedException
Called on checkpoint or end of input so that the writer to flush all pending data for at-least-once.- Throws:
IOException
InterruptedException
-
writeWatermark
default void writeWatermark(Watermark watermark) throws IOException, InterruptedException
Adds a watermark to the writer.This method is intended for advanced sinks that propagate watermarks.
- Parameters:
watermark
- The watermark.- Throws:
IOException
- if fail to add a watermark.InterruptedException
-
-