package actor
- Alphabetic
- Public
- All
Type Members
- sealed abstract class ActorPublisherMessage extends DeadLetterSuppression
- sealed abstract class ActorSubscriberMessage extends DeadLetterSuppression with NoSerializationVerificationNeeded
- abstract class MaxInFlightRequestStrategy extends RequestStrategy
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. - trait RequestStrategy extends AnyRef
An ActorSubscriber defines a
RequestStrategy
to control the stream back pressure. - final case class WatermarkRequestStrategy(highWatermark: Int, lowWatermark: Int) extends RequestStrategy with Product with Serializable
Requests up to the
highWatermark
when theremainingRequested
is below thelowWatermark
.Requests up to the
highWatermark
when theremainingRequested
is below thelowWatermark
. This a good strategy when the actor performs work itself.
Deprecated Type Members
- trait ActorPublisher[T] extends Actor
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
whenisActive
andtotalDemand > 0
, otherwiseonNext
will throwIllegalStateException
.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.
- Annotations
- @deprecated
- Deprecated
(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.
- trait ActorSubscriber extends Actor
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.- Annotations
- @deprecated
- Deprecated
(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.
Value Members
- object ActorPublisherMessage
- object ActorSubscriber
- object ActorSubscriberMessage
- object OneByOneRequestStrategy extends RequestStrategy with Product with Serializable
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. - object WatermarkRequestStrategy extends Serializable
- object ZeroRequestStrategy extends RequestStrategy with Product with Serializable
When request is only controlled with manual calls to ActorSubscriber#request.
Deprecated Value Members
- object ActorPublisher
- Annotations
- @deprecated
- Deprecated
(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.