Class CollectSink<IN>

  • All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.functions.Function, org.apache.flink.api.common.functions.RichFunction, org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction<IN>

    @Experimental
    public class CollectSink<IN>
    extends org.apache.flink.streaming.api.functions.sink.legacy.RichSinkFunction<IN>
    A specialized data sink to be used by DataStreamUtils.collect().

    This experimental class is relocated from flink-streaming-contrib. Please see package-info.java for more information.

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction

        org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction.Context
    • Constructor Summary

      Constructors 
      Constructor 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the connection with the Socket server.
      void invoke​(IN value, org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction.Context context)  
      void open​(org.apache.flink.api.common.functions.OpenContext openContext)
      Initialize the connection with the Socket in the server.
      • Methods inherited from class org.apache.flink.api.common.functions.AbstractRichFunction

        getIterationRuntimeContext, getRuntimeContext, setRuntimeContext
      • Methods inherited from interface org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction

        finish, invoke, writeWatermark
    • Constructor Detail

      • CollectSink

        public 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.
        Parameters:
        hostIp - IP address of the Socket server.
        port - Port of the Socket server.
        serializer - A serializer for the data.
    • Method Detail

      • invoke

        public void invoke​(IN value,
                           org.apache.flink.streaming.api.functions.sink.legacy.SinkFunction.Context context)
                    throws Exception
        Throws:
        Exception
      • open

        public void open​(org.apache.flink.api.common.functions.OpenContext openContext)
                  throws Exception
        Initialize the connection with the Socket in the server.
        Specified by:
        open in interface org.apache.flink.api.common.functions.RichFunction
        Overrides:
        open in class org.apache.flink.api.common.functions.AbstractRichFunction
        Parameters:
        openContext - the context.
        Throws:
        Exception
      • close

        public void close()
                   throws Exception
        Closes the connection with the Socket server.
        Specified by:
        close in interface org.apache.flink.api.common.functions.RichFunction
        Overrides:
        close in class org.apache.flink.api.common.functions.AbstractRichFunction
        Throws:
        Exception