I've been experimenting with akka-http in akka 2.3.4 with little luck -- 
evidently I am missing something (+ I'm an Akka newbie - which doesn't help 
:( )

I'm coming at this from the Java API (via Groovy -- doubt if that is my 
problem though - Akka has worked marvelously with Groovy so far) and I have 
the following (tucked inside an Actor so an Akka system etc is all set up 
..)

import akka.http.model.japi.HttpMethods
import akka.http.model.japi.Http
import akka.http.model.japi.HttpRequest
import akka.http.model.japi.Uri
import akka.pattern.Patterns
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import scala.concurrent.Future

        try {
            HttpRequest foo = HttpRequest.create()

            foo.withUri(Uri.create("http://spray.io/";))
            foo.withMethod(HttpMethods.GET)

            final ActorRef http = Http.get(context.system()).manager()
            Future f = Patterns.ask(http, foo, 15000)
            println "${Await.result(f, Duration.apply(15000L, "millis"))}"
        } catch (Exception e) {
            e.printStackTrace()
        }

All goes swimmingly until the Await.result() which eventually times out:

Error |
         akka.pattern.AskTimeoutException: Ask timed out on 
[Actor[akka://jcore/user/IO-HTTP#396415378]] after [15000 ms]
Error |
        at 
akka.pattern.PromiseActorRef$$anonfun$1.apply$mcV$sp(AskSupport.scala:333)
Error |
        at akka.actor.Scheduler$$anon$7.run(Scheduler.scala:117)
Error |
        at 
scala.concurrent.Future$InternalCallbackExecutor$.scala$concurrent$Future$InternalCallbac
kExecutor$$unbatchedExecute(Future.scala:694)
Error | .....

Which I interpret to mean that the Request message got to the HTTP manager 
but no reply was forthcoming. Evidently I am misunderstanding something 
here and I'm hoping someone can set me straight  :)

Tnx
Alan

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

Reply via email to