Object
SubmissionPublisher<T>
MergeProcessor<T>
- All Implemented Interfaces:
AutoCloseable
,Flow.Publisher<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:
- issues
Flow.Subscriber.onComplete()
only when all publishers to which this processor subscribed issuedFlow.Subscriber.onComplete()
. - if at least one of the publishers issued
Flow.Subscriber.onError(Throwable)
then this processor will issueFlow.Subscriber.onError(Throwable)
instead ofFlow.Subscriber.onComplete()
with all the exceptions suppressed inside
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
Create a new subscriber which can be subscribed to some publisher.Methods inherited from class SubmissionPublisher
closeExceptionally, consume, estimateMaximumLag, estimateMinimumDemand, getClosedException, getExecutor, getMaxBufferCapacity, getNumberOfSubscribers, getSubscribers, hasSubscribers, isClosed, isSubscribed, offer, offer, submit, subscribe
-
Constructor Details
-
MergeProcessor
public MergeProcessor()
-
-
Method Details
-
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 interfaceAutoCloseable
- Overrides:
close
in classSubmissionPublisher<T>
-