IN
- Input type parameter.@Public public interface SinkFunction<IN> extends Function, Serializable
Modifier and Type | Interface and Description |
---|---|
static interface |
SinkFunction.Context
Context that
SinkFunctions can use for getting additional data about an
input record. |
Modifier and Type | Method and Description |
---|---|
default void |
finish()
This method is called at the end of data processing.
|
default void |
invoke(IN value)
Deprecated.
|
default void |
invoke(IN value,
SinkFunction.Context context)
Writes the given value to the sink.
|
default void |
writeWatermark(Watermark watermark)
Writes the given watermark to the sink.
|
@Deprecated default void invoke(IN value) throws Exception
invoke(Object, Context)
.Exception
default void invoke(IN value, SinkFunction.Context context) throws Exception
You have to override this method when implementing a SinkFunction
, this is a
default
method for backward compatibility with the old-style method only.
value
- The input record.context
- Additional context about the input record.Exception
- This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.default void writeWatermark(Watermark watermark) throws Exception
This method is intended for advanced sinks that propagate watermarks.
watermark
- The watermark.Exception
- This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.default void finish() throws Exception
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.
Exception
- This method may throw exceptions. Throwing an exception will cause the
operation to fail and may trigger recovery.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.