Class SocketClientSink<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.api.functions.sink.legacy.SocketClientSink<IN>
- Type Parameters:
IN- data to be written into the Socket.
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.functions.Function,org.apache.flink.api.common.functions.RichFunction,SinkFunction<IN>
Deprecated.
Socket client that acts as a streaming sink. The data is sent to a Socket as a byte array.
The sink can be set to retry message sends after the sending failed.
The sink can be set to 'autoflush', in which case the socket stream is flushed after every message. This significantly reduced throughput, but also decreases message latency.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction
SinkFunction.Context -
Constructor Summary
ConstructorsConstructorDescriptionSocketClientSink(String hostName, int port, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema) Deprecated.Creates a new SocketClientSink.SocketClientSink(String hostName, int port, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema, int maxNumRetries) Deprecated.Creates a new SocketClientSink that retries connections upon failure up to a given number of times.SocketClientSink(String hostName, int port, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema, int maxNumRetries, boolean autoflush) Deprecated.Creates a new SocketClientSink that retries connections upon failure up to a given number of times. -
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
-
SocketClientSink
public SocketClientSink(String hostName, int port, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema) Deprecated.Creates a new SocketClientSink. The sink will not attempt to retry connections upon failure and will not auto-flush the stream.- Parameters:
hostName- Hostname of the server to connect to.port- Port of the server.schema- Schema used to serialize the data into bytes.
-
SocketClientSink
public SocketClientSink(String hostName, int port, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema, int maxNumRetries) Deprecated.Creates a new SocketClientSink that retries connections upon failure up to a given number of times. A value of -1 for the number of retries will cause the system to retry an infinite number of times. The sink will not auto-flush the stream.- Parameters:
hostName- Hostname of the server to connect to.port- Port of the server.schema- Schema used to serialize the data into bytes.maxNumRetries- The maximum number of retries after a message send failed.
-
SocketClientSink
public SocketClientSink(String hostName, int port, org.apache.flink.api.common.serialization.SerializationSchema<IN> schema, int maxNumRetries, boolean autoflush) Deprecated.Creates a new SocketClientSink that retries connections upon failure up to a given number of times. A value of -1 for the number of retries will cause the system to retry an infinite number of times.- Parameters:
hostName- Hostname of the server to connect to.port- Port of the server.schema- Schema used to serialize the data into bytes.maxNumRetries- The maximum number of retries after a message send failed.autoflush- Flag to indicate whether the socket stream should be flushed after each message.
-
-
Method Details
-
open
Deprecated.- Specified by:
openin interfaceorg.apache.flink.api.common.functions.RichFunction- Overrides:
openin classorg.apache.flink.api.common.functions.AbstractRichFunction- Throws:
Exception
-
invoke
Deprecated.Called when new data arrives to the sink, and forwards it to Socket.- Parameters:
value- The value to write to the socket.- Throws:
Exception
-
close
Deprecated.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
-
getCurrentNumberOfRetries
@VisibleForTesting public int getCurrentNumberOfRetries()Deprecated.
-
Sinkinterface instead.