1
此代碼似乎沒有工作了,試圖創建一個HTTP客戶端/流當外部HTTP請求:Akka Streams&Http。在版本1.0 RC4
lazy val myConnectionFlow =
Http().outgoingConnection("localhost", port).flow
def myRequest(request: HttpRequest): Future[HttpResponse] =
Source.single(request).via(myConnectionFlow).runWith(Sink.head)
看來flow
方法不再可用。它確實已被棄用?以下是現在創建Http連接的首選方式嗎?
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)