ActorSink.actorRef

Sends the elements of the stream to the given ActorRef<T>ActorRef[T].

Actor interop operators

Dependency

This operator is included in:

sbt
libraryDependencies += "com.typesafe.akka" %% "akka-stream-typed" % "2.5.16"
Maven
<dependency>
  <groupId>com.typesafe.akka</groupId>
  <artifactId>akka-stream-typed_2.11</artifactId>
  <version>2.5.16</version>
</dependency>
Gradle
dependencies {
  compile group: 'com.typesafe.akka', name: 'akka-stream-typed_2.11', version: '2.5.16'
}

Signature

def actorRef[T](ref: ActorRef[T], onCompleteMessage: T, onFailureMessage: Throwable ⇒ T): Sink[T, NotUsed]

Description

Sends the elements of the stream to the given ActorRef. If the target actor terminates the stream will be canceled. When the stream is completed successfully the given onCompleteMessage will be sent to the destination actor. When the stream is completed with failure a the throwable that was signaled to the stream is adapted to the Actors protocol using onFailureMessage and then then sent to the destination actor.

It will request at most maxInputBufferSize number of elements from upstream, but 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 operator in front of this Sink.

Examples

TODO (in progress)

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.