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
Processor
designed 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 void
doOnComplete()
ImplementSubscriber.onComplete()
.protected void
doOnError(java.lang.Throwable t)
ImplementSubscriber.onError(Throwable)
.protected void
doOnNext(R message)
ImplementSubscriber.onNext(Object)
.protected void
doOnSubscribe(org.reactivestreams.Subscription subscription)
ImplementSubscriber.onSubscribe(Subscription)
.protected org.reactivestreams.Subscriber<? super T>
getDownstreamSubscriber()
Resolve the currentSubscriber
.protected abstract void
onUpstreamMessage(R message)
Called when an message is received from the upstreamSubscriber
.void
subscribe(org.reactivestreams.Subscriber<? super T> downstreamSubscriber)
protected void
subscribeDownstream(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:
subscribe
in interfaceorg.reactivestreams.Publisher<R>
-
doOnComplete
protected void doOnComplete()
Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onComplete()
.- Specified by:
doOnComplete
in classSingleThreadedBufferingSubscriber<R>
-
doOnNext
protected void doOnNext(R message)
Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onNext(Object)
.- Specified by:
doOnNext
in classSingleThreadedBufferingSubscriber<R>
- Parameters:
message
- The message
-
doOnSubscribe
protected void doOnSubscribe(org.reactivestreams.Subscription subscription)
Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onSubscribe(Subscription)
.- Specified by:
doOnSubscribe
in classSingleThreadedBufferingSubscriber<R>
- Parameters:
subscription
- The subscription
-
doOnError
protected void doOnError(java.lang.Throwable t)
Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onError(Throwable)
.- Specified by:
doOnError
in 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
Optional
of the subscriber
-
getDownstreamSubscriber
protected org.reactivestreams.Subscriber<? super T> getDownstreamSubscriber()
Resolve the currentSubscriber
.- Returns:
- An
Optional
of the subscriber - Throws:
java.lang.IllegalStateException
- If noSubscriber
is present
-
-