Interface SinkFunction<IN>

    • Method Detail

      • 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.