Improvements to documentation on Stream-Actor interop (#30503)

* Remove unused parameter to example class AckingReceiver

* Update description of Source.actorRef to match the current API design (since 2.6.0)

* Improve the description of what happens after the Actor receives a completion request

* More accurate wording.
This commit is contained in:
Daryl Odnert 2021-08-12 08:12:47 -07:00 committed by GitHub
parent 16384e2b7d
commit 086974b91f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View file

@ -172,18 +172,18 @@ for this Source type, i.e. elements will be dropped if the buffer is filled by s
at a rate that is faster than the stream can consume. You should consider using `Source.queue`
if you want a backpressured actor interface.
The stream can be completed successfully by sending `akka.actor.Status.Success` to the actor reference.
If the content is `akka.stream.CompletionStrategy.immediately` the completion will be signaled immediately.
If the content is `akka.stream.CompletionStrategy.draining` already buffered elements will be signaled before signaling completion.
Any other content will be ignored and fall back to the draining behaviour.
The stream can be completed successfully by sending any message to the actor that is handled
by the completion matching function that was provided when the actor reference was created.
If the returned completion strategy is `akka.stream.CompletionStrategy.immediately` the completion will be signaled immediately.
If the completion strategy is `akka.stream.CompletionStrategy.draining`, already buffered elements will be processed before signaling completion.
Any elements that are in the actor's mailbox and subsequent elements sent to the actor will not be processed.
The stream can be completed with failure by sending `akka.actor.Status.Failure` to the
actor reference.
The stream can be completed with failure by sending any message to the
actor that is handled by the failure matching function that was specified
when the actor reference was created.
Note: Sending a `PoisonPill` is deprecated and will be ignored in the future.
The actor will be stopped when the stream is completed, failed or cancelled from downstream,
i.e. you can watch it to get notified when that happens.
The actor will be stopped when the stream is completed, failed or cancelled from downstream.
You can watch it to get notified when that happens.
Scala

View file

@ -203,7 +203,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val onErrorMessage = (ex: Throwable) => AckingReceiver.StreamFailure(ex)
val probe = TestProbe()
val receiver = system.actorOf(Props(new AckingReceiver(probe.ref, ackWith = AckMessage)))
val receiver = system.actorOf(Props(new AckingReceiver(probe.ref)))
val sink = Sink.actorRefWithBackpressure(
receiver,
onInitMessage = InitMessage,
@ -229,7 +229,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
final case class StreamFailure(ex: Throwable)
}
class AckingReceiver(probe: ActorRef, ackWith: Any) extends Actor with ActorLogging {
class AckingReceiver(probe: ActorRef) extends Actor with ActorLogging {
import AckingReceiver._
def receive: Receive = {