Sorry for a late response,

You can use pipe pattern
<http://doc.akka.io/docs/akka/2.3.12/scala/futures.html#Use_With_Actors> to
send response to your actor as a message when future completes.

On Sat, Jul 11, 2015 at 4:04 AM, Gary Struthers <[email protected]>
wrote:

> I have a simple scaladsl server and it works with this ScalatestRouteTest
> test
>
>   it should "return existing Checking Account Balances" in {
>
>     Post(s"/account/balances/checking", GetAccountBalances(1L)) ~> routes
> ~> check {
>
>       status shouldBe OK
>
>       contentType shouldBe `application/json`
>
>       responseAs[CheckingAccountBalances] shouldBe CheckingAccountBalances
> (Some(List((1,1000.1))))
>
>     }
>
>   }
> I want to make the equivalent call from an actor. My first problem is
> composing the request
>
> Source.single(HttpRequest(POST, uri = "/account/balances/checking",
> entity = ???) -> 1L)
>
> On the server I'm doing this for marshaling/unmarshalling case classes to
> json
>
> trait BalancesProtocols extends DefaultJsonProtocol {
>
>   implicit val getAccountBalancesFormat = jsonFormat1(GetAccountBalances)
>
> But I don't see how to turn this RootJsonFormat into an entity for the
> request
>
>
> Then, in the actor do I just call it in receive like this
>
> val future: Future[HttpResponse] = Source.single(
> ...).via(connectionPoolFlow).runWith(Sink.head)
>
>
> I was hoping for a way to tell/receive instead of a synchronous call.
>
>
> Gary
>
> --
> >>>>>>>>>> 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.
>



-- 
Martynas Mickevičius
Typesafe <http://typesafe.com/> – Reactive
<http://www.reactivemanifesto.org/> Apps on the JVM

-- 
>>>>>>>>>>      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.

Reply via email to