Interface SubpartitionSelector<T>

  • Type Parameters:
    T - data type that could be used to represent a subpartition.
    All Known Implementing Classes:
    RoundRobinSubpartitionSelector

    public interface SubpartitionSelector<T>
    SubpartitionSelector helps to choose from multiple available subpartitions when their output buffers should union into one stream.
    • Method Detail

      • notifyDataAvailable

        boolean notifyDataAvailable​(T subpartition)
        Marks a subpartition as having data available.
        Returns:
        true if this selector did not already contain the subpartition.
      • getNextSubpartitionToConsume

        T getNextSubpartitionToConsume()
        Returns the next subpartition to consume data.
      • markLastConsumptionStatus

        void markLastConsumptionStatus​(boolean isDataAvailable,
                                       boolean isPartialRecord)
        Records the status of the last consumption attempt on the subpartition returned by the last invocation of getNextSubpartitionToConsume().

        This method must be invoked every time a subpartition acquired from this class is consumed.

        Parameters:
        isDataAvailable - whether the consumption returned a valid data.
        isPartialRecord - whether the returned data contains partial record. Ignored if there was no data available.
      • isMoreSubpartitionSwitchable

        boolean isMoreSubpartitionSwitchable()
        Whether the invoker can get a different subpartition in the next invocation of getNextSubpartitionToConsume().