Requests up to the max
and also takes the number of messages
that have been queued internally or delegated to other actors into account.
Requests up to the max
and also takes the number of messages
that have been queued internally or delegated to other actors into account.
Concrete subclass must implement #inFlightInternally.
It will request elements in minimum batches of the defined #batchSize.
An ActorSubscriber defines a RequestStrategy
to control the stream back pressure.
Requests up to the highWatermark
when the remainingRequested
is
below the lowWatermark
.
Requests up to the highWatermark
when the remainingRequested
is
below the lowWatermark
. This a good strategy when the actor performs work itself.
Java API compatible with lambda expressions
Java API compatible with lambda expressions
(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.
Java API compatible with lambda expressions.
Java API compatible with lambda expressions.
This class adds a Stash to AbstractActorPublisher
.
(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.
akka.stream.actor.ActorPublisher and akka.stream.actor.AbstractActorWithStash
Java API compatible with lambda expressions.
Java API compatible with lambda expressions.
This class adds an unbounded Stash to AbstractActorPublisher
.
(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.
akka.stream.actor.ActorPublisher and akka.stream.actor.AbstractActorWithUnboundedStash
Java API compatible with lambda expressions.
Java API compatible with lambda expressions.
This class adds an unrestricted Stash to AbstractActorPublisher
.
(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.
akka.stream.actor.ActorPublisher and akka.stream.actor.AbstractActorWithUnrestrictedStash
Java API compatible with lambda expressions
Java API compatible with lambda expressions
(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.
Extend/mixin this trait in your akka.actor.Actor to make it a stream publisher that keeps track of the subscription life cycle and requested elements.
Extend/mixin this trait in your akka.actor.Actor to make it a stream publisher that keeps track of the subscription life cycle and requested elements.
Create a org.reactivestreams.Publisher backed by this actor with Scala API ActorPublisher#apply, or Java API UntypedActorPublisher#create or Java API compatible with lambda expressions AbstractActorPublisher#create.
It can be attached to a org.reactivestreams.Subscriber or be used as an input source for a akka.stream.scaladsl.Flow. You can only attach one subscriber to this publisher.
The life cycle state of the subscription is tracked with the following boolean members: #isActive, #isCompleted, #isErrorEmitted, and #isCanceled.
You send elements to the stream by calling #onNext. You are allowed to send as many
elements as have been requested by the stream subscriber. This amount can be inquired with
#totalDemand. It is only allowed to use onNext
when isActive
and totalDemand > 0
,
otherwise onNext
will throw IllegalStateException
.
When the stream subscriber requests more elements the ActorPublisher#Request message is delivered to this actor, and you can act on that event. The #totalDemand is updated automatically.
When the stream subscriber cancels the subscription the ActorPublisher#Cancel message
is delivered to this actor. After that subsequent calls to onNext
will be ignored.
You can complete the stream by calling #onComplete. After that you are not allowed to call #onNext, #onError and #onComplete.
You can terminate the stream with failure by calling #onError. After that you are not allowed to call #onNext, #onError and #onComplete.
If you suspect that this ActorPublisher may never get subscribed to, you can override the #subscriptionTimeout method to provide a timeout after which this Publisher should be considered canceled. The actor will be notified when the timeout triggers via an akka.stream.actor.ActorPublisherMessage.SubscriptionTimeoutExceeded message and MUST then perform cleanup and stop itself.
If the actor is stopped the stream will be completed, unless it was not already terminated with failure, completed or canceled.
(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.
Extend/mixin this trait in your akka.actor.Actor to make it a stream subscriber with full control of stream back pressure.
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.
Java API
Java API
(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.
Java API
Java API
(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.
Java API compatible with lambda expressions
Requests one more element when remainingRequested
is 0, i.e.
Requests one more element when remainingRequested
is 0, i.e.
max one element in flight.
Java API
Java API
When request is only controlled with manual calls to ActorSubscriber#request.
Java API compatible with lambda expressions
Java API compatible with lambda expressions
(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.
(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.