Hi,
we have a problem with Akka HTTP on Windows: after creating a server
binding and unbinding it, it is not possible to bind it again. We get a
akka.stream.BindFailedException. On Linux, this works without problems.
The application uses the following code to create the server binding:
private val binding: Future[ServerBinding] = {
val httpsContext = if (protocol == Protocol.Https)
Some(HttpsContexts.serverContext) else None
val serverSource: Source[Http.IncomingConnection,
Future[Http.ServerBinding]] = Http(actorSystem).bind(interface = interface,
port = port, httpsContext = httpsContext)
logger.info("Binding to interface " + interface + ":" + port + " using
" + protocol)
val bindingFuture: Future[ServerBinding] = serverSource.to(Sink.foreach
{ connection =>
connection.handleWith(route)
}).run()
bindingFuture
}
binding onComplete {
case Success(result) => logger.info("Bound to interface " + interface +
":" + port + " using " + protocol)
case Failure(reason) => logger.error("Could not bind to interface " +
interface + ":" + port + " using " + protocol, reason)
}
protected override def dispose(): Unit = {
// stop webserver
for(binding <- binding) {
binding.unbind() onComplete {
case Success(result) => logger.info("Unbound " + binding)
case Failure(reason) => logger.error("Could not unbind " + binding,
reason)
}
}
}
Restarting the application solves the problem.
Is there anything I can do to solve the problem?
Thanks,
Michael
--
>>>>>>>>>> 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.