Interface ChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>

Type Parameters:
T - the type of record which is sent through the attached output gate
All Known Implementing Classes:
BroadcastPartitioner, CustomPartitionerWrapper, ForwardForConsecutiveHashPartitioner, ForwardForUnspecifiedPartitioner, ForwardPartitioner, GlobalPartitioner, KeyGroupStreamPartitioner, OutputEmitter, RebalancePartitioner, RescalePartitioner, RoundRobinChannelSelector, ShufflePartitioner, StreamPartitioner

public interface ChannelSelector<T extends org.apache.flink.core.io.IOReadableWritable>
The ChannelSelector determines to which logical channels a record should be written to.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether the channel selector always selects all the output channels.
    int
    selectChannel(T record)
    Returns the logical channel index, to which the given record should be written.
    void
    setup(int numberOfChannels)
    Initializes the channel selector with the number of output channels.
  • Method Details

    • setup

      void setup(int numberOfChannels)
      Initializes the channel selector with the number of output channels.
      Parameters:
      numberOfChannels - the total number of output channels which are attached to respective output gate.
    • selectChannel

      int selectChannel(T record)
      Returns the logical channel index, to which the given record should be written. It is illegal to call this method for broadcast channel selectors and this method can remain not implemented in that case (for example by throwing UnsupportedOperationException).
      Parameters:
      record - the record to determine the output channels for.
      Returns:
      an integer number which indicates the index of the output channel through which the record shall be forwarded.
    • isBroadcast

      boolean isBroadcast()
      Returns whether the channel selector always selects all the output channels.
      Returns:
      true if the selector is for broadcast mode.