Class CollectSink<IN>
java.lang.Object
org.apache.flink.api.common.functions.AbstractRichFunction
org.apache.flink.streaming.api.functions.sink.legacy.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,org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction<IN>
@Experimental
public class CollectSink<IN>
extends org.apache.flink.streaming.api.functions.sink.legacy.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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction
org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction.Context -
Constructor Summary
ConstructorsConstructorDescriptionCollectSink(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
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
getIterationRuntimeContext, getRuntimeContext, setRuntimeContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction
finish, invoke, writeWatermark
-
Constructor Details
-
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 Details
-
invoke
public void invoke(IN value, org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction.Context context) throws Exception - Throws:
Exception
-
open
Initialize 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:
openContext- the context.- Throws:
Exception
-
close
Closes the connection with the Socket server.- Specified by:
closein interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
closein classorg.apache.flink.api.common.functions.AbstractRichFunction- Throws:
Exception
-