Hello,
I'm very excited about the new Akka streams + http features. Migrating
some sample code from Spray to Akka-Http I encountered a small problem in a
utility class I use to fire http requests. Code here:
import akka.http.Http
import akka.http.model._
import akka.io.IO
import akka.pattern.ask
import akka.actor.ActorSystem
import akka.util.Timeout
import scala.concurrent.{ Await, Future }
import scala.concurrent.duration._
import scala.language.postfixOps
import scala.concurrent.ExecutionContext.Implicits.global
object Util {
def httpGet( uri:String )(implicit s:ActorSystem, timeout:Timeout = 30
seconds) = {
val resp = _http( HttpRequest(HttpMethods.GET, Uri(uri)) )
(resp.entity.toString, resp.status)
}
private def _http( hr:HttpRequest )(implicit s:ActorSystem, timeout:Timeout
= 30 seconds) = {
val response: Future[HttpResponse] = (IO(Http) ? hr).mapTo[HttpResponse]
Await.result( response, Duration.Inf )
}
}
I get the following error on the key line IO(...):
[error]
/Users/Greg/git/docker-exp/src/main/scala/com.gwz.dockerexp/Util.scala:66:
inferred type arguments [akka.http.HttpExt] do not conform to method
apply's type parameter bounds [T <: akka.io.IO.Extension]
[error] val response: Future[HttpResponse] = (IO(Http) ?
hr).mapTo[HttpResponse]
This worked great for the Spray libs. How can I modify this to work with
Akka-Http, as the Http object is clearly different?
Thanks!
Greg
--
>>>>>>>>>> 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.