What behavior would you want when there are multiple elements in the first
source? What would the value in the outer onComplete be?

On Fri, Jun 5, 2015 at 12:17 PM, Prog <programad...@gmail.com> wrote:

> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
√

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to