INTERNAL API
INTERNAL API
INTERNAL API
INTERNAL API
INTERNAL API
INTERNAL API
INTERNAL API
INTERNAL API
INTERNAL API
INTERNAL API
Cancel upstream subscription.
Cancel upstream subscription. No more elements will be delivered after cancel.
The ActorSubscriber will be stopped immediately after signaling cancellation. In case the upstream subscription has not yet arrived the Actor will stay alive until a subscription arrives, cancel it and then stop itself.
The number of stream elements that have already been requested from upstream but not yet received.
The number of stream elements that have already been requested from upstream but not yet received.
Request a number of elements from upstream.
Request a number of elements from upstream.
Extend/mixin this trait in your akka.actor.Actor to make it a stream subscriber with full control of stream back pressure. It will receive ActorSubscriberMessage.OnNext, ActorSubscriberMessage.OnComplete and ActorSubscriberMessage.OnError messages from the stream. It can also receive other, non-stream messages, in the same way as any actor.
Attach the actor as a org.reactivestreams.Subscriber to the stream with Scala API ActorSubscriber#apply, or Java API UntypedActorSubscriber#create or Java API compatible with lambda expressions AbstractActorSubscriber#create.
Subclass must define the RequestStrategy to control stream back pressure. After each incoming message the
ActorSubscriber
will automatically invoke the RequestStrategy#requestDemand and propagate the returned demand to the stream. The provided WatermarkRequestStrategy is a good strategy if the actor performs work itself. The provided MaxInFlightRequestStrategy is useful if messages are queued internally or delegated to other actors. You can also implement a custom RequestStrategy or call #request manually together with ZeroRequestStrategy or some other strategy. In that case you must also call #request when the actor is started or when it is ready, otherwise it will not receive any elements.(Since version 2.5.0) Use
akka.stream.stage.GraphStage
instead, it allows for all operations an Actor would and is more type-safe as well as guaranteed to be ReactiveStreams compliant.