Class AsyncAggregatingSubscriber<T>

java.lang.Object
io.camunda.zeebe.backup.s3.util.AsyncAggregatingSubscriber<T>
All Implemented Interfaces:
org.reactivestreams.Subscriber<CompletableFuture<T>>

public class AsyncAggregatingSubscriber<T> extends Object implements org.reactivestreams.Subscriber<CompletableFuture<T>>
Aggregates the results of futures published by a org.reactivestreams.Publisher<CompletableFuture>.

Once the subscription is started, multiple futures are requested from the publisher. New futures are requested whenever a future completes. The maximum number of requested futures must be provided in AsyncAggregatingSubscriber(long parallelism)}

If a futures completes exceptionally, the result is completed exceptionally.

  • Constructor Details

    • AsyncAggregatingSubscriber

      public AsyncAggregatingSubscriber(long parallelism)
  • Method Details

    • onSubscribe

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

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

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

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

      public CompletableFuture<Collection<T>> result()
      Returns:
      A future that is completed with the results once all of them have been collected.