!str #15551 Switch to implicit passing of FlowMaterializer

* implicit param
* change tests to use implicit materializer
* add ActorFlow trait that provides an implicit materializer inside an actor
  in the right way, i.e. encourage usage of that instead of
  implicit def mat(implicit arf: ActorRef): FlowMaterializer
* make http compile, but those who know the api better will have to adjust
  to take full advantage of the implicit materializer
This commit is contained in:
Patrik Nordwall 2014-08-21 08:38:24 +02:00
parent fa243e656b
commit 1bb5d37780
71 changed files with 447 additions and 375 deletions

View file

@ -26,7 +26,7 @@ class HttpServerExampleSpec
implicit val system = ActorSystem()
import system.dispatcher
val materializer = FlowMaterializer(MaterializerSettings())
implicit val materializer = FlowMaterializer(MaterializerSettings())
implicit val askTimeout: Timeout = 500.millis
val bindingFuture = IO(Http) ? Http.Bind(interface = "localhost", port = 8080)
@ -37,7 +37,7 @@ class HttpServerExampleSpec
println("Accepted new connection from " + remoteAddress)
// handle connection here
}, materializer)
})
}
//#bind-example
}
@ -52,7 +52,7 @@ class HttpServerExampleSpec
implicit val system = ActorSystem()
import system.dispatcher
val materializer = FlowMaterializer(MaterializerSettings())
implicit val materializer = FlowMaterializer(MaterializerSettings())
implicit val askTimeout: Timeout = 500.millis
val bindingFuture = IO(Http) ? Http.Bind(interface = "localhost", port = 8080)
@ -78,8 +78,8 @@ class HttpServerExampleSpec
case Http.IncomingConnection(remoteAddress, requestProducer, responseConsumer)
println("Accepted new connection from " + remoteAddress)
Flow(requestProducer).map(requestHandler).produceTo(responseConsumer, materializer)
}, materializer)
Flow(requestProducer).map(requestHandler).produceTo(responseConsumer)
})
}
//#full-server-example
}