Class SingleThreadedBufferingProcessor<R,T>
- java.lang.Object
-
- io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber<R>
-
- io.micronaut.core.async.processor.SingleThreadedBufferingProcessor<R,T>
-
- Type Parameters:
T- The argument typeR- The message type
- All Implemented Interfaces:
Completable,Emitter<R>,org.reactivestreams.Processor<R,T>,org.reactivestreams.Publisher<T>,org.reactivestreams.Subscriber<R>
public abstract class SingleThreadedBufferingProcessor<R,T> extends SingleThreadedBufferingSubscriber<R> implements org.reactivestreams.Processor<R,T>
A Reactive streams
Processordesigned to be used within a single thread and manage back pressure state.This processor only supports a single
Subscriber- Since:
- 1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber
SingleThreadedBufferingSubscriber.BackPressureState, SingleThreadedBufferingSubscriber.DownstreamSubscription
-
-
Field Summary
-
Fields inherited from class io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber
upstreamBuffer, upstreamDemand, upstreamState, upstreamSubscription
-
-
Constructor Summary
Constructors Constructor Description SingleThreadedBufferingProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.Optional<org.reactivestreams.Subscriber<? super T>>currentDownstreamSubscriber()Resolve the currentSubscriber.protected voiddoOnComplete()ImplementSubscriber.onComplete().protected voiddoOnError(java.lang.Throwable t)ImplementSubscriber.onError(Throwable).protected voiddoOnNext(R message)ImplementSubscriber.onNext(Object).protected voiddoOnSubscribe(org.reactivestreams.Subscription subscription)ImplementSubscriber.onSubscribe(Subscription).protected org.reactivestreams.Subscriber<? super T>getDownstreamSubscriber()Resolve the currentSubscriber.protected abstract voidonUpstreamMessage(R message)Called when an message is received from the upstreamSubscriber.voidsubscribe(org.reactivestreams.Subscriber<? super T> downstreamSubscriber)protected voidsubscribeDownstream(org.reactivestreams.Subscriber<? super T> downstreamSubscriber)-
Methods inherited from class io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber
newDownstreamSubscription, onComplete, onError, onNext, onSubscribe, provideDownstreamSubscription
-
-
-
-
Method Detail
-
subscribe
public void subscribe(org.reactivestreams.Subscriber<? super T> downstreamSubscriber)
- Specified by:
subscribein interfaceorg.reactivestreams.Publisher<R>
-
doOnComplete
protected void doOnComplete()
Description copied from class:SingleThreadedBufferingSubscriberImplementSubscriber.onComplete().- Specified by:
doOnCompletein classSingleThreadedBufferingSubscriber<R>
-
doOnNext
protected void doOnNext(R message)
Description copied from class:SingleThreadedBufferingSubscriberImplementSubscriber.onNext(Object).- Specified by:
doOnNextin classSingleThreadedBufferingSubscriber<R>- Parameters:
message- The message
-
doOnSubscribe
protected void doOnSubscribe(org.reactivestreams.Subscription subscription)
Description copied from class:SingleThreadedBufferingSubscriberImplementSubscriber.onSubscribe(Subscription).- Specified by:
doOnSubscribein classSingleThreadedBufferingSubscriber<R>- Parameters:
subscription- The subscription
-
doOnError
protected void doOnError(java.lang.Throwable t)
Description copied from class:SingleThreadedBufferingSubscriberImplementSubscriber.onError(Throwable).- Specified by:
doOnErrorin classSingleThreadedBufferingSubscriber<R>- Parameters:
t- The throwable
-
subscribeDownstream
protected void subscribeDownstream(org.reactivestreams.Subscriber<? super T> downstreamSubscriber)
- Parameters:
downstreamSubscriber- The downstream subscriber
-
onUpstreamMessage
protected abstract void onUpstreamMessage(R message)
Called when an message is received from the upstreamSubscriber.- Parameters:
message- The message
-
currentDownstreamSubscriber
protected java.util.Optional<org.reactivestreams.Subscriber<? super T>> currentDownstreamSubscriber()
Resolve the currentSubscriber.- Returns:
- An
Optionalof the subscriber
-
getDownstreamSubscriber
protected org.reactivestreams.Subscriber<? super T> getDownstreamSubscriber()
Resolve the currentSubscriber.- Returns:
- An
Optionalof the subscriber - Throws:
java.lang.IllegalStateException- If noSubscriberis present
-
-