@Experimental public class CollectSink<IN> extends RichSinkFunction<IN>
This experimental class is relocated from flink-streaming-contrib. Please see package-info.java for more information.
SinkFunction.Context
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection with the Socket server.
|
void |
invoke(IN value,
SinkFunction.Context context)
Writes the given value to the sink.
|
void |
open(org.apache.flink.configuration.Configuration parameters)
Initialize the connection with the Socket in the server.
|
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invoke
public CollectSink(InetAddress hostIp, int port, org.apache.flink.api.common.typeutils.TypeSerializer<IN> serializer)
hostIp
- IP address of the Socket server.port
- Port of the Socket server.serializer
- A serializer for the data.public void invoke(IN value, SinkFunction.Context context) throws Exception
SinkFunction
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.public void open(org.apache.flink.configuration.Configuration parameters) throws Exception
open
in interface org.apache.flink.api.common.functions.RichFunction
open
in class org.apache.flink.api.common.functions.AbstractRichFunction
parameters
- Configuration.Exception
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.