akka.stream

actor

package actor

Visibility
  1. Public
  2. All

Type Members

  1. trait ActorConsumer extends Actor

    Extend/mixin this trait in your akka.actor.Actor to make it a stream consumer with full control of stream back pressure.

    Extend/mixin this trait in your akka.actor.Actor to make it a stream consumer with full control of stream back pressure. It will receive ActorConsumer.OnNext, ActorConsumer.OnComplete and ActorConsumer.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.api.Consumer to the stream with ActorConsumer#apply.

    Subclass must define the RequestStrategy to control stream back pressure. After each incoming message the ActorConsumer will automatically invoke the RequestStrategy#requestDemand and propagate the returned demand to the stream. The provided ActorConsumer.WatermarkRequestStrategy is a good strategy if the actor performs work itself. The provided ActorConsumer.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 ActorConsumer.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.

  2. trait ActorProducer[T] extends Actor

    Extend/mixin this trait in your akka.actor.Actor to make it a stream producer 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 producer that keeps track of the subscription life cycle and requested elements.

    Create a org.reactivestreams.api.Producer backed by this actor with ActorProducer#apply. It can be attached to a org.reactivestreams.api.Consumer or be used as an input source for a akka.stream.Flow. You can only attach one subscriber to this producer.

    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 consumer. 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 consumer requests more elements the ActorProducer#Request message is delivered to this actor, and you can act on that event. The #totalDemand is updated automatically.

    When the stream consumer cancels the subscription the ActorProducer#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 the actor is stopped the stream will be completed, unless it was not already terminated with failure, completed or canceled.

Value Members

  1. object ActorConsumer

  2. object ActorProducer

Ungrouped