Hi,
I have the code bellow and I have tried many different variations of it
with mapAsync in the place of forEach and goes on, but for some reason when
I break the communication on the server side in the middle of the transfer
I get the error in the inside Sink.onComplete, but the error it is not
reflected to the outer Sink.onComplete. So I get in the console:
---- in error
--- out success
I would like to have a Failure in both Sink.onComplete. How can I achieve
that?
val conn: Flow[HttpRequest, HttpResponse, Future[Http.OutgoingConnection]] =
Http().outgoingConnection(host)
val finish = Source.single(HttpRequest(uri = uri)).via(conn).runForeach({
response =>
if (response.status == StatusCodes.OK) {
response.entity.dataBytes.map { data =>
println(data)
}.runWith(Sink.onComplete({
case Success(resp) => {
println("---- in success")
}
case Failure(error) => {
println("---- in failure")
}
case _ => {
println("---- in error")
}
}))
} else
{ println("status"+ response.status)}
})
finish.onComplete({
case Success(resp) => {
println("---- out succes: " + resp)
}
case Failure(error) => {
println("---- out failure")
}
case _ => {
println("---- out error")
}
})
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.