Hi

I am building a simple reverse proxy as an exercise to understand Akka 
Streams. I have read the new docs but could not find an answer.

I'm using FlexiRoute as recommended in an earlier thread to determine when 
my Akka HTTP service should proxy to the remote service and when not to. 
But even if the flow does not go through the reverse proxy part of the 
graph, I still see a remote connection established in the logs. This 
happens every single time, regardless of input request. 

It looks as if the connection gets initialized when materializing the flow, 
after that the connection times out when that part of the flow is never 
reached. 

How do I avoid this behaviour? 

I only want the connection to be established when that part of the graph 
flow is executed. 

This is the flow graph setup:

    val partialBranch = PartialFlowGraph {
      implicit b ⇒
        import FlowGraphImplicits._
        val route = new BranchRoute[HttpRequest]
        val merge = MergePreferred[HttpResponse]
        in ~> proxyBranch ~> route.in
        route.success ~> proxyTo ~> con ~> merge
        route.failure ~> badRequestFlow ~> merge.preferred
        merge ~> out
    }


Please see this gist for a fully working example: 
https://gist.github.com/magnusart/bffe1a15dab30f794235

Oh, and merry christmas! :)

/Magnus
 

-- 
>>>>>>>>>>      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.

Reply via email to