2015-08-15 94 views
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) 

回答

0

是的。實驗模塊沒有貶低期,特別是在達到1.0之前。

相關問題