Deprecates status message based api #27503 (#27519)

* Deprecates status message based api #27503
* Deprecates actorRefWithAck for actorRefWithBackpressure
This commit is contained in:
Nicolas Vollmar 2019-09-10 11:59:19 +02:00 committed by Patrik Nordwall
parent aee0152da2
commit 751918e84c
34 changed files with 618 additions and 195 deletions

View file

@ -23,6 +23,7 @@ import akka.testkit.TestProbe;
// #actor-ref-imports
import java.util.Arrays;
import java.util.Optional;
// #imports
@ -86,13 +87,20 @@ public class SourceDocExamples {
// #actor-ref
}
static void actorRefWithAck() {
static void actorRefWithBackpressure() {
final TestProbe probe = null;
// #actor-ref-with-ack
// #actorRefWithBackpressure
final ActorSystem system = ActorSystem.create();
Source<Object, ActorRef> source = Source.actorRefWithAck("ack");
Source<Object, ActorRef> source =
Source.actorRefWithBackpressure(
"ack",
o -> {
if (o == "complete") return Optional.of(CompletionStrategy.draining());
else return Optional.empty();
},
o -> Optional.empty());
ActorRef actorRef = source.to(Sink.foreach(System.out::println)).run(system);
probe.send(actorRef, "hello");
@ -101,7 +109,7 @@ public class SourceDocExamples {
probe.expectMsg("ack");
// The stream completes successfully with the following message
actorRef.tell(new Success(CompletionStrategy.draining()), ActorRef.noSender());
// #actor-ref-with-ack
actorRef.tell("complete", ActorRef.noSender());
// #actorRefWithBackpressure
}
}