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

@ -187,8 +187,8 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
probe.expectMsg("akkateam@somewhere.com")
}
"actorRefWithAck" in {
//#actorRefWithAck
"actorRefWithBackpressure" in {
//#actorRefWithBackpressure
val words: Source[String, NotUsed] =
Source(List("hello", "hi"))
@ -202,7 +202,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val probe = TestProbe()
val receiver = system.actorOf(Props(new AckingReceiver(probe.ref, ackWith = AckMessage)))
val sink = Sink.actorRefWithAck(
val sink = Sink.actorRefWithBackpressure(
receiver,
onInitMessage = InitMessage,
ackMessage = AckMessage,
@ -215,10 +215,10 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
probe.expectMsg("hello")
probe.expectMsg("hi")
probe.expectMsg("Stream completed!")
//#actorRefWithAck
//#actorRefWithBackpressure
}
//#actorRefWithAck-actor
//#actorRefWithBackpressure-actor
object AckingReceiver {
case object Ack
@ -248,7 +248,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
log.error(ex, "Stream failed!")
}
}
//#actorRefWithAck-actor
//#actorRefWithBackpressure-actor
"lookup email with mapAsync and supervision" in {
val addressSystem = new AddressSystem2

View file

@ -50,8 +50,8 @@ object SourceOperators {
//#actorRef
}
def actorRefWithAck(): Unit = {
//#actorRefWithAck
def actorRefWithBackpressure(): Unit = {
//#actorRefWithBackpressure
import akka.actor.Status.Success
import akka.actor.ActorRef
@ -61,7 +61,9 @@ object SourceOperators {
implicit val system: ActorSystem = ActorSystem()
val probe = TestProbe()
val source: Source[Any, ActorRef] = Source.actorRefWithAck[Any]("ack")
val source: Source[Any, ActorRef] = Source.actorRefWithBackpressure[Any]("ack", {
case _: Success => CompletionStrategy.immediately
}, PartialFunction.empty)
val actorRef: ActorRef = source.to(Sink.foreach(println)).run()
probe.send(actorRef, "hello")
@ -70,7 +72,7 @@ object SourceOperators {
probe.expectMsg("ack")
// The stream completes successfully with the following message
actorRef ! Success(CompletionStrategy.immediately)
//#actorRefWithAck
actorRef ! Success(())
//#actorRefWithBackpressure
}
}