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>
,Processor<R,
,T> Publisher<T>
,Subscriber<R>
- Direct Known Subclasses:
JacksonCoreProcessor
,JacksonProcessor
public abstract class SingleThreadedBufferingProcessor<R,T>
extends SingleThreadedBufferingSubscriber<R>
implements 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
- Author:
- Graeme Rocher
-
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<Subscriber<? super T>>
Resolve the currentSubscriber
.protected void
ImplementSubscriber.onComplete()
.protected void
ImplementSubscriber.onError(Throwable)
.protected void
ImplementSubscriber.onNext(Object)
.protected void
doOnSubscribe
(Subscription subscription) ImplementSubscriber.onSubscribe(Subscription)
.protected Subscriber<? super T>
Resolve the currentSubscriber
.protected abstract void
onUpstreamMessage
(R message) Called when an message is received from the upstreamSubscriber
.void
subscribe
(Subscriber<? super T> downstreamSubscriber) protected void
subscribeDownstream
(Subscriber<? super T> downstreamSubscriber) Methods inherited from class io.micronaut.core.async.subscriber.SingleThreadedBufferingSubscriber
newDownstreamSubscription, onComplete, onError, onNext, onSubscribe, provideDownstreamSubscription
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.reactivestreams.Subscriber
onComplete, onError, onNext, onSubscribe
-
Constructor Details
-
SingleThreadedBufferingProcessor
public SingleThreadedBufferingProcessor()
-
-
Method Details
-
subscribe
-
doOnComplete
protected void doOnComplete()Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onComplete()
.- Specified by:
doOnComplete
in classSingleThreadedBufferingSubscriber<R>
-
doOnNext
Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onNext(Object)
.- Specified by:
doOnNext
in classSingleThreadedBufferingSubscriber<R>
- Parameters:
message
- The message
-
doOnSubscribe
Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onSubscribe(Subscription)
.- Specified by:
doOnSubscribe
in classSingleThreadedBufferingSubscriber<R>
- Parameters:
subscription
- The subscription
-
doOnError
Description copied from class:SingleThreadedBufferingSubscriber
ImplementSubscriber.onError(Throwable)
.- Specified by:
doOnError
in classSingleThreadedBufferingSubscriber<R>
- Parameters:
t
- The throwable
-
subscribeDownstream
- Parameters:
downstreamSubscriber
- The downstream subscriber
-
onUpstreamMessage
Called when an message is received from the upstreamSubscriber
.- Parameters:
message
- The message
-
currentDownstreamSubscriber
Resolve the currentSubscriber
.- Returns:
- An
Optional
of the subscriber
-
getDownstreamSubscriber
Resolve the currentSubscriber
.- Returns:
- An
Optional
of the subscriber - Throws:
IllegalStateException
- If noSubscriber
is present
-