Unable to compile project using Akka-HTTP client V1.0

112 views
Skip to first unread message

Richard Grossman

unread,
Sep 8, 2015, 12:14:14 PM9/8/15
to Akka User List
Hi

I'm confronted to this problem :

I'm using this dependencies:
akka-http-experimental_2.11 V1.0 latest release

My code is pretty simple as exactly like the sample on the documentation

class HttpFlow(implicit system: ActorSystem, actorMaterializer: ActorMaterializer) {

 
protected implicit val executor: ExecutionContext = system.dispatcher

  val poolConfig
= ConnectionPoolSettings(system)
  val flowConnection
= Http().cachedHostConnectionPool[Unit]("rtbe.adsymptotic.com", settings = poolConfig)

 
def callHTTP(request : HttpRequest) : Future[(Try[HttpResponse], Unit)] = {
   
Source.single[HttpRequest](request)
     
.via(flowConnection)
     
.runWith(Sink.head)
 
}
}


I got a compilation error:
Error:(27, 12) type mismatch;
 found   : akka.stream.scaladsl.Flow[(akka.http.scaladsl.model.HttpRequest, Nothing),(scala.util.Try[akka.http.scaladsl.model.HttpResponse], Nothing),akka.http.scaladsl.Http.HostConnectionPool]
 required: akka.stream.Graph[akka.stream.FlowShape[akka.http.scaladsl.model.HttpRequest,?],?]
      .via(flowConnection)
           ^

Is another way to use the HTTP client in 1.0 and the documentation is not updated ?

Thanks


Roland Kuhn

unread,
Sep 9, 2015, 2:10:48 AM9/9/15
to akka-user
Hi Richard,

the documentation is actually compiled and tested: you overlooked "-> 42" in the example, which in your case needs to be "-> ()" (in the argument to Source.single).

Regards,

Roland

--
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


Richard Grossman

unread,
Sep 9, 2015, 4:10:34 AM9/9/15
to akka...@googlegroups.com
Many Thanks Roland for your answer
Could you explain what the signification of "-> 42" or "-> ()" ?

Is this a Map Entry ? if yes what to do after with the 42 ?

Thanks

You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/nC2Ek-oeurc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.

Roland Kuhn

unread,
Sep 9, 2015, 4:22:23 AM9/9/15
to akka-user
Hi Richard,


Regards,

Roland
Reply all
Reply to author
Forward
0 new messages