Hi All,
I have been playing around with akka-http 0.7. I basically modified this
example
http://doc.akka.io/docs/akka-stream-and-http-experimental/0.4/scala/http-core-server.html
from akka-http 0.4 with a FlowFrom and a custom request handler:
val requestHandler: HttpRequest ⇒ Future[HttpResponse] = {
case _: HttpRequest ⇒
Future.successful(HttpResponse(StatusCodes.NotFound, entity = "Unknown
resource!"))
}
val bindingFuture = IO(Http) ? Http.Bind(interface = "0.0.0.0", port =
8080)
bindingFuture foreach {
case Http.ServerBinding(localAddress, connectionStream) ⇒
val flow = FlowFrom(connectionStream).map {
case Http.IncomingConnection(remoteAddress, requestProducer,
responseConsumer) ⇒
println("accepted connection from " + remoteAddress)
FlowFrom(requestProducer).mapFuture(requestHandler).publishTo(responseConsumer)
}
flow.consume()
case x =>
println("not a server binding " + x)
}
One thing I am currently not able to figure out is how to unbind an akka
http connection. There is no unbind message in the Http object like there
is in. Any pointers?
Cheers,
Rüdiger
--
>>>>>>>>>> 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.