Class StoringSubscriber<T>

java.lang.Object
software.amazon.awssdk.utils.async.StoringSubscriber<T>
All Implemented Interfaces:
org.reactivestreams.Subscriber<T>

public class StoringSubscriber<T> extends Object implements org.reactivestreams.Subscriber<T>
An implementation of Subscriber that stores the events it receives for retrieval.

Events can be observed via peek() and poll(). The number of events stored is limited by the maxElements configured at construction.

  • Constructor Details

    • StoringSubscriber

      public StoringSubscriber(int maxEvents)
      Create a subscriber that stores up to maxElements events for retrieval.
  • Method Details

    • peek

      Check the first event stored in this subscriber.

      This will return empty if no events are currently available (outstanding demand has not yet been filled).

    • poll

      Remove and return the first event stored in this subscriber.

      This will return empty if no events are currently available (outstanding demand has not yet been filled).

    • onSubscribe

      public void onSubscribe(org.reactivestreams.Subscription subscription)
      Specified by:
      onSubscribe in interface org.reactivestreams.Subscriber<T>
    • onNext

      public void onNext(T t)
      Specified by:
      onNext in interface org.reactivestreams.Subscriber<T>
    • onComplete

      public void onComplete()
      Specified by:
      onComplete in interface org.reactivestreams.Subscriber<T>
    • onError

      public void onError(Throwable throwable)
      Specified by:
      onError in interface org.reactivestreams.Subscriber<T>