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:
parent
16384e2b7d
commit
086974b91f
2 changed files with 12 additions and 12 deletions
|
|
@ -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`
|
at a rate that is faster than the stream can consume. You should consider using `Source.queue`
|
||||||
if you want a backpressured actor interface.
|
if you want a backpressured actor interface.
|
||||||
|
|
||||||
The stream can be completed successfully by sending `akka.actor.Status.Success` to the actor reference.
|
The stream can be completed successfully by sending any message to the actor that is handled
|
||||||
If the content is `akka.stream.CompletionStrategy.immediately` the completion will be signaled immediately.
|
by the completion matching function that was provided when the actor reference was created.
|
||||||
If the content is `akka.stream.CompletionStrategy.draining` already buffered elements will be signaled before signaling completion.
|
If the returned completion strategy is `akka.stream.CompletionStrategy.immediately` the completion will be signaled immediately.
|
||||||
Any other content will be ignored and fall back to the draining behaviour.
|
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
|
The stream can be completed with failure by sending any message to the
|
||||||
actor reference.
|
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.
|
||||||
|
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,
|
|
||||||
i.e. you can watch it to get notified when that happens.
|
|
||||||
|
|
||||||
|
|
||||||
Scala
|
Scala
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
|
||||||
val onErrorMessage = (ex: Throwable) => AckingReceiver.StreamFailure(ex)
|
val onErrorMessage = (ex: Throwable) => AckingReceiver.StreamFailure(ex)
|
||||||
|
|
||||||
val probe = TestProbe()
|
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(
|
val sink = Sink.actorRefWithBackpressure(
|
||||||
receiver,
|
receiver,
|
||||||
onInitMessage = InitMessage,
|
onInitMessage = InitMessage,
|
||||||
|
|
@ -229,7 +229,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
|
||||||
final case class StreamFailure(ex: Throwable)
|
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._
|
import AckingReceiver._
|
||||||
|
|
||||||
def receive: Receive = {
|
def receive: Receive = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue