Interface SinkFunction<IN>

Type Parameters:
IN - Input type parameter.
All Superinterfaces:
org.apache.flink.api.common.functions.Function, Serializable
All Known Implementing Classes:
CollectSinkFunction, OutputFormatSinkFunction, PrintSinkFunction, RichSinkFunction, SocketClientSink

@Internal @Deprecated public interface SinkFunction<IN> extends org.apache.flink.api.common.functions.Function, Serializable
Deprecated.
This interface will be removed in future versions. Use the new Sink interface instead.
Interface for implementing user defined sink functionality.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Deprecated.
    Context that SinkFunctions can use for getting additional data about an input record.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Deprecated.
    This method is called at the end of data processing.
    default void
    invoke(IN value)
    Deprecated.
    default void
    invoke(IN value, SinkFunction.Context context)
    Deprecated.
    Writes the given value to the sink.
    default void
    writeWatermark(org.apache.flink.api.common.eventtime.Watermark watermark)
    Deprecated.
    Writes the given watermark to the sink.
  • Method Details

    • invoke

      default void invoke(IN value) throws Exception
      Deprecated.
      Throws:
      Exception
    • invoke

      default void invoke(IN value, SinkFunction.Context context) throws Exception
      Deprecated.
      Writes the given value to the sink. This function is called for every record.

      You have to override this method when implementing a SinkFunction, this is a default method for backward compatibility with the old-style method only.

      Parameters:
      value - The input record.
      context - Additional context about the input record.
      Throws:
      Exception - This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
    • writeWatermark

      default void writeWatermark(org.apache.flink.api.common.eventtime.Watermark watermark) throws Exception
      Deprecated.
      Writes the given watermark to the sink. This function is called for every watermark.

      This method is intended for advanced sinks that propagate watermarks.

      Parameters:
      watermark - The watermark.
      Throws:
      Exception - This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.
    • finish

      default void finish() throws Exception
      Deprecated.
      This method is called at the end of data processing.

      The method is expected to flush all remaining buffered data. Exceptions will cause the pipeline to be recognized as failed, because the last data items are not processed properly. You may use this method to flush remaining buffered elements in the state into transactions which you can commit in the last checkpoint.

      NOTE:This method does not need to close any resources. You should release external resources in the AbstractRichFunction.close() method.

      Throws:
      Exception - This method may throw exceptions. Throwing an exception will cause the operation to fail and may trigger recovery.