Interface BufferConsumer.Upstream

All Known Implementing Classes:
NettyBodyAdapter
Enclosing interface:
BufferConsumer

public static interface BufferConsumer.Upstream
This interface manages the backpressure for data consumptions. It is highly concurrent: Calls to onBytesConsumed(long) may happen at the same time on different threads.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Allow the upstream to discard any further messages.
    default void
    Instruct the upstream to ignore backpressure from this consumer.
    void
    onBytesConsumed(long bytesConsumed)
    Called when a number of bytes has been consumed by the downstream.
    default void
    Signal that we want to start consuming bytes.
  • Method Details

    • start

      default void start()
      Signal that we want to start consuming bytes. This is an optional hint to the upstream, the upstream may ignore it and send bytes immediately. This is used for CONTINUE support.
    • onBytesConsumed

      void onBytesConsumed(long bytesConsumed)
      Called when a number of bytes has been consumed by the downstream.
      Parameters:
      bytesConsumed - The number of bytes that were consumed
    • allowDiscard

      default void allowDiscard()
      Allow the upstream to discard any further messages. Note that this does not actually mean the messages must be discarded: If another consumer still needs the body data, it may continue to be read and continue to be forwarded to this consumer.
    • disregardBackpressure

      default void disregardBackpressure()
      Instruct the upstream to ignore backpressure from this consumer. This is slightly different from onBytesConsumed(Long.MAX_VALUE): If there are two consumers in ByteBody.SplitBackpressureMode.FASTEST mode, a MAX_VALUE requests all data from the common upstream, while a disregardBackpressure removes this downstream from consideration.