Hi,

I have a client example where it connects via Http to a server that streams 
json events to the client, by keeping the continuous open.

val fromHttpResponseToString: Flow[HttpResponse, String, NotUsed] = Flow[
HttpResponse].mapAsync(1)(Unmarshal(_).to[String])

    val validRequestFilter: Flow[HttpResponse, HttpResponse, NotUsed] = Flow
[HttpResponse].filter(_.status.isSuccess())


    val flow: Flow[HttpRequest, HttpResponse, Future[Http.OutgoingConnection
]] = connection.connection()

    val response = Source.single(request)

     .via(flow)

     .buffer(1, OverflowStrategy.backpressure)

     .via(validRequestFilter)

     .via(fromHttpResponseToString)

    response.runWith(Sink.foreach { x => println(" Received event: " + x) 
}).onComplete { _ =>

      println("########### Shutting down")

      system.terminate()

    }




1. I am trying to transform a HttpResponse in a flow, but it seems to not 
be executed at all. If I remove the fromHttpResponseToString
I do can log the events. What am I doing wrong?
2. On other problem is that if the server streams too many events at once, 
the client does not seem to log/receive them all, resulting in loss of 
events. How could I handle backpressure here? And should the handling of 
this backpressure also be included by the server or can I relay on the 
client to pause the stream when necessary?
3. I did read many akka-stream examples on the internet( blogs and 
documentation page). But I wounder if the Akka-stream framework should 
fully replace Actors, or should it be used in conjunction with Actors?


-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to