@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,
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(OpenContext openContext)
Initialize the connection with the Socket in the server.
|
getIterationRuntimeContext, getRuntimeContext, open, setRuntimeContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
finish, invoke, writeWatermark
public CollectSink(InetAddress hostIp, int port, 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(OpenContext openContext) throws Exception
openContext
- the context.Exception
- Implementations may forward exceptions, which are caught by the runtime.
When the runtime catches an exception, it aborts the task and lets the fail-over logic
decide whether to retry the task execution.public void close() throws Exception
close
in interface RichFunction
close
in class AbstractRichFunction
Exception
- Implementations may forward exceptions, which are caught by the runtime.
When the runtime catches an exception, it aborts the task and lets the fail-over logic
decide whether to retry the task execution.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.