ActorSink.actorRef

Sends the elements of the stream to the given ActorRef<T>ActorRef[T] of the new actors API, without considering backpressure.

Actor interop operators

Dependency

This operator is included in:

sbt
val PekkoVersion = "1.0.1"
libraryDependencies += "org.apache.pekko" %% "pekko-stream-typed" % PekkoVersion
Maven
<properties>
  <scala.binary.version>2.13</scala.binary.version>
</properties>
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.apache.pekko</groupId>
      <artifactId>pekko-bom_${scala.binary.version}</artifactId>
      <version>1.0.1</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
<dependencies>
  <dependency>
    <groupId>org.apache.pekko</groupId>
    <artifactId>pekko-stream-typed_${scala.binary.version}</artifactId>
  </dependency>
</dependencies>
Gradle
def versions = [
  ScalaBinary: "2.13"
]
dependencies {
  implementation platform("org.apache.pekko:pekko-bom_${versions.ScalaBinary}:1.0.1")

  implementation "org.apache.pekko:pekko-stream-typed_${versions.ScalaBinary}"
}

Signature

ActorSink.actorRefActorSink.actorRef

Description

Sends the elements of the stream to the given ActorRef. If the target actor terminates the stream will be canceled. When the stream completes successfully the given onCompleteMessage will be sent to the destination actor. When the stream completes with failure the throwable that was signaled to the stream is adapted to the Actor’s protocol using onFailureMessage and 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.

See also:

Reactive Streams semantics

cancels when the actor terminates

backpressures never