!str #16521 Add ActorRefSink

* also rename the factory for ActorSubscriber props Sink,
  from apply to actorSubscriber
This commit is contained in:
Patrik Nordwall 2015-03-30 14:42:30 +02:00
parent 8f47b6dfcc
commit 946faedd95
11 changed files with 247 additions and 43 deletions

View file

@ -7,8 +7,12 @@ Integration
Integrating with Actors
=======================
:class:`AbstractActorPublisher` and :class:`AbstractActorSubscriber` are two traits that provides support for
implementing Reactive Streams :class:`Publisher` and :class:`Subscriber` with an :class:`Actor`.
For piping the elements of a stream as messages to an ordinary actor you can use the
``Sink.actorRef``.
For more advanced use cases the :class:`ActorPublisher` and :class:`ActorSubscriber` traits are
provided to support implementing Reactive Streams :class:`Publisher` and :class:`Subscriber` with
an :class:`Actor`.
These can be consumed by other Reactive Stream libraries or used as a
Akka Streams :class:`Source` or :class:`Sink`.
@ -24,6 +28,20 @@ Akka Streams :class:`Source` or :class:`Sink`.
prior to 8, Akka provides :class:`UntypedActorPublisher` and :class:`UntypedActorSubscriber` which can be used
easily from any language level.
Sink.actorRef
^^^^^^^^^^^^^
The sink sends the elements of the stream to the given `ActorRef`. If the target actor terminates
the stream will be cancelled. When the stream is completed successfully the given ``onCompleteMessage``
will be sent to the destination actor. When the stream is completed with failure a ``akka.actor.Status.Failure``
message will be sent to the destination actor.
.. warning::
There is no back-pressure signal from the destination actor, i.e. if the actor is not consuming
the messages fast enough the mailbox of the actor will grow. For potentially slow consumer actors
it is recommended to use a bounded mailbox with zero `mailbox-push-timeout-time` or use a rate
limiting stage in front of this stage.
ActorPublisher
^^^^^^^^^^^^^^