Module id.xfunction

Class MergeProcessor<T>

Object
SubmissionPublisher<T>
MergeProcessor<T>
All Implemented Interfaces:
AutoCloseable, Flow.Publisher<T>

public class MergeProcessor<T> extends SubmissionPublisher<T>
Merge multiple subscriptions for different publishers into one.

This processor manages multiple subscribers which can be created with newSubscriber(). It will manage all the subscriptions from them and will deliver all messages it receives to its own subscriber. It supports only one subscriber at a time.

This processor stops only when there is no more active publishers (all of them either issued Flow.Subscriber.onComplete() or Flow.Subscriber.onError(Throwable)) and it:

  • Constructor Details

    • MergeProcessor

      public MergeProcessor()
  • Method Details

    • newSubscriber

      public Flow.Subscriber<T> newSubscriber()
      Create a new subscriber which can be subscribed to some publisher. All items which are received by this subscriber will be merged into internal queue and delivered to this processor subscriber.
    • getNumOfActiveSubscriptions

      public int getNumOfActiveSubscriptions()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class SubmissionPublisher<T>