@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<T>
构造器和说明 |
---|
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.
|
限定符和类型 | 方法和说明 |
---|---|
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
在接口中 org.apache.flink.api.common.functions.RichFunction
open
在类中 org.apache.flink.api.common.functions.AbstractRichFunction
parameters
- Configuration.Exception
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.