Hi, 

I just checked the TestServer in akka-http-tests project.

I'm wondering  whether I can do dispatching logic with handleXXXX method 
like below: (Or, do dispatching within a Route which can be implicitly 
transformed to a flow)

    val binding = Http().bindAndHandleAsync({

      case req@HttpRequest(_, Uri.Path("/admin"), _, _, _)     => call some 
other Route 

      case req@HttpRequest(_, Uri.Path("/biz"), _, _, _)     =>  ask an 
actor to get a Future[Response]

      case _: HttpRequest ⇒ defaultResponse() // to return a default 
Future[HttpResponse]

    }, interface = "localhost", port = 9001)


I'm asking this is because for a complex application, user might push down 
logic into lower level artifacts instead of binding it directly at the very 
top.

And I'm not sure if it's a good practice to use bindAndHandleAsync of doing 
this dispatching, or should I use a Flow with bindAndHandle?




Thanks in advance!


Leon

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