+str #18142 ask pattern integration for akka streams
progressed with cleanup, removing the same thread exec context is weird... causes issues :-/ Need to debug more, could be that some race also exists in mapAsync then :\ WIP finish ask impl via watch stage mima consistency spec fix paradox, and fix adding ask/watch to javadsl source follow up review
This commit is contained in:
parent
5040ce82f1
commit
4714f16dcf
18 changed files with 643 additions and 47 deletions
|
|
@ -140,19 +140,18 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
|
|||
implicit val materializer = ActorMaterializer()
|
||||
val ref: ActorRef = system.actorOf(Props[Translator])
|
||||
|
||||
"mapAsync + ask" in {
|
||||
//#mapAsync-ask
|
||||
import akka.pattern.ask
|
||||
"ask" in {
|
||||
//#ask
|
||||
implicit val askTimeout = Timeout(5.seconds)
|
||||
val words: Source[String, NotUsed] =
|
||||
Source(List("hello", "hi"))
|
||||
|
||||
words
|
||||
.mapAsync(parallelism = 5)(elem ⇒ (ref ? elem).mapTo[String])
|
||||
.ask[String](parallelism = 5)(ref)
|
||||
// continue processing of the replies from the actor
|
||||
.map(_.toLowerCase)
|
||||
.runWith(Sink.ignore)
|
||||
//#mapAsync-ask
|
||||
//#ask
|
||||
}
|
||||
|
||||
"calling external service with mapAsync" in {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue