Class CollectSink<IN>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.streaming.api.functions.sink.RichSinkFunction<IN>
-
- org.apache.flink.streaming.experimental.CollectSink<IN>
-
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.RichFunction,SinkFunction<IN>
@Experimental public class CollectSink<IN> extends RichSinkFunction<IN>
A specialized data sink to be used by DataStreamUtils.collect().This experimental class is relocated from flink-streaming-contrib. Please see package-info.java for more information.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.sink.SinkFunction
SinkFunction.Context
-
-
Constructor Summary
Constructors Constructor Description CollectSink(InetAddress hostIp, int port, org.apache.flink.api.common.typeutils.TypeSerializer<IN> serializer)Creates a CollectSink that will send the data to the specified host.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the connection with the Socket server.voidinvoke(IN value, SinkFunction.Context context)Writes the given value to the sink.voidopen(org.apache.flink.configuration.Configuration parameters)Initialize the connection with the Socket in the server.-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.streaming.api.functions.sink.SinkFunction
finish, invoke, writeWatermark
-
-
-
-
Constructor Detail
-
CollectSink
public CollectSink(InetAddress hostIp, int port, org.apache.flink.api.common.typeutils.TypeSerializer<IN> serializer)
Creates a CollectSink that will send the data to the specified host.- Parameters:
hostIp- IP address of the Socket server.port- Port of the Socket server.serializer- A serializer for the data.
-
-
Method Detail
-
invoke
public void invoke(IN value, SinkFunction.Context context) throws Exception
Description copied from interface:SinkFunctionWrites 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 adefaultmethod 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.
-
open
public void open(org.apache.flink.configuration.Configuration parameters) throws ExceptionInitialize the connection with the Socket in the server.- Specified by:
openin interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
openin classorg.apache.flink.api.common.functions.AbstractRichFunction- Parameters:
parameters- Configuration.- Throws:
Exception
-
-