Interface SinkWriter<InputT>
-
- Type Parameters:
InputT- The type of the sink writer's input
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
StatefulSink.StatefulSinkWriter<InputT,WriterStateT>,TwoPhaseCommittingSink.PrecommittingSinkWriter<InputT,CommT>
- All Known Implementing Classes:
PrintSinkOutputWriter
@PublicEvolving public interface SinkWriter<InputT> extends AutoCloseable
TheSinkWriteris responsible for writing data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSinkWriter.ContextContext 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 voidflush(boolean endOfInput)Called on checkpoint or end of input so that the writer to flush all pending data for at-least-once.voidwrite(InputT element, SinkWriter.Context context)Adds an element to the writer.default voidwriteWatermark(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, InterruptedExceptionCalled on checkpoint or end of input so that the writer to flush all pending data for at-least-once.- Throws:
IOExceptionInterruptedException
-
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
-
-