Class SocketClientSink<IN>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.streaming.api.functions.sink.RichSinkFunction<IN>
-
- org.apache.flink.streaming.api.functions.sink.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 @PublicEvolving public class SocketClientSink<IN> extends RichSinkFunction<IN>
Deprecated.This interface will be removed in future versions. Use the newSinkinterface instead.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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.sink.SinkFunction
SinkFunction.Context
-
-
Constructor Summary
Constructors Constructor Description SocketClientSink(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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.Closes the connection with the Socket server.voidinvoke(IN value)Deprecated.Called when new data arrives to the sink, and forwards it to Socket.voidopen(org.apache.flink.configuration.Configuration parameters)Deprecated.This method is deprecated since Flink 1.19.-
Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction
getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.streaming.api.functions.sink.SinkFunction
finish, invoke, writeWatermark
-
-
-
-
Constructor Detail
-
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 Detail
-
open
@Deprecated public void open(org.apache.flink.configuration.Configuration parameters) throws Exception
Deprecated.This method is deprecated since Flink 1.19. The users are recommended to implementopen(OpenContext openContext)and overrideopen(Configuration parameters)with an empty body instead. 1. If you implementopen(OpenContext openContext), theopen(OpenContext openContext)will be invoked and theopen(Configuration parameters)won't be invoked. 2. If you don't implementopen(OpenContext openContext), theopen(Configuration parameters)will be invoked in the default implementation of theopen(OpenContext openContext).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:
parameters- The configuration containing the parameters attached to the contract.- Throws:
Exception- if an error happens.- See Also:
- FLIP-344: Remove parameter in RichFunction#open
-
invoke
public void invoke(IN value) throws Exception
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
-
-