Using akka http to bind to a port and then route incoming connections is fairly easy, given the documentation .
One issue that has not been addressed is how to connect multiple ports for different routes. If I have several specifications:
val route1 : Flow[HttpRequest, HttpResponse,_] = ???
val interface1 : String = ???
val port1 : Int = ???
val route2 : Flow[HttpRequest, HttpResponse,_] = ???
val interface2 : String = ???
val port2 : Int = ???
Should they be associated with one HttpExt?
implicit val actorSystem : akka.actor.ActorSystem = ???
val httpExt = akka.http.scaladsl.Http()
httpExt.bindAndHandle(route1, interface1, port1)
httpExt.bindAndHandle(route2, interface2, port2)
Or, if you use a different one for each binding HttpExt?
Http().bindAndHandle(route1, interface1, port1)
Http().bindAndHandle(route2, interface2, port2)
If any of them is valid, are there any consequences for using one method over another?
Thank you in advance for your feedback and response.
source
share