在尝试创建http客户端/流程时,此代码似乎不再起作用了:
lazy val myConnectionFlow =
Http().outgoingConnection("localhost", port).flow
def myRequest(request: HttpRequest): Future[HttpResponse] =
Source.single(request).via(myConnectionFlow).runWith(Sink.head)
似乎flow
方法不再可用。它确实被弃用了吗?以下是创建Http Connections的首选方法吗?
val connFlow: Flow[HttpRequest, HttpResponse, Future[Http.OutgoingConnection]] =
Http().outgoingConnection("localhost", port)
val responseFuture: Future[HttpResponse] =
Source.single(HttpRequest(uri="XXX"))
.via(connFlow).runWith(Sink.head)
答案 0 :(得分:0)
是。实验模块没有弃用期,特别是在达到1.0之前。