Class PrintSink<IN>

java.lang.Object
org.apache.flink.streaming.api.functions.sink.PrintSink<IN>
Type Parameters:
IN - Input record type
All Implemented Interfaces:
Serializable, org.apache.flink.api.common.SupportsConcurrentExecutionAttempts, org.apache.flink.api.connector.sink2.Sink<IN>

@PublicEvolving public class PrintSink<IN> extends Object implements org.apache.flink.api.connector.sink2.Sink<IN>, org.apache.flink.api.common.SupportsConcurrentExecutionAttempts
Sink implementation writing every element to the standard output or standard error stream.

Four possible format options:

  • sinkIdentifier:subtaskIndex> output <- sinkIdentifier provided and parallelism > 1,
  • sinkIdentifier> output <- sinkIdentifier provided and parallelism == 1
  • subtaskIndex> output <- no sinkIdentifier provided and parallelism > 1
  • output <- no sinkIdentifier provided and parallelism == 1
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a print sink function that prints to STDOUT.
    PrintSink(boolean stdErr)
    Instantiates a print sink that prints to STDOUT or STDERR.
    PrintSink(String sinkIdentifier)
    Instantiates a print sink that prints to STDOUT and gives a sink identifier.
    PrintSink(String sinkIdentifier, boolean stdErr)
    Instantiates a print sink that prints to STDOUT or STDERR and gives a sink identifier.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.flink.api.connector.sink2.SinkWriter<IN>
    createWriter(org.apache.flink.api.connector.sink2.WriterInitContext context)
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PrintSink

      public PrintSink()
      Instantiates a print sink function that prints to STDOUT.
    • PrintSink

      public PrintSink(boolean stdErr)
      Instantiates a print sink that prints to STDOUT or STDERR.
      Parameters:
      stdErr - True, if the format should print to standard error instead of standard out.
    • PrintSink

      public PrintSink(String sinkIdentifier)
      Instantiates a print sink that prints to STDOUT and gives a sink identifier.
      Parameters:
      sinkIdentifier - Message that identifies the sink and is prefixed to the output of the value
    • PrintSink

      public PrintSink(String sinkIdentifier, boolean stdErr)
      Instantiates a print sink that prints to STDOUT or STDERR and gives a sink identifier.
      Parameters:
      sinkIdentifier - Message that identifies the sink and is prefixed to the output of the value
      stdErr - True if the sink should print to STDERR instead of STDOUT.
  • Method Details

    • createWriter

      public org.apache.flink.api.connector.sink2.SinkWriter<IN> createWriter(org.apache.flink.api.connector.sink2.WriterInitContext context) throws IOException
      Specified by:
      createWriter in interface org.apache.flink.api.connector.sink2.Sink<IN>
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object