Reputation: 382
I am trying out Akka HTTP, and I have created a service that returns a Json Array of domain objects in HttpResponse. In the client I want to convert it to a Source of domain objects so it can be consumed by the subsequent Flows and Sinks.
Referring to the Json Support section: http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/common/json-support.html
I have done the necessary to define implicit RootJsonReader etc, but I don’t know how to make use of the FromEntityUnmarshaller.
My code is here: https://github.com/charlesxucheng/akka-http-microservice
It is based on the akka-http-microservice activator template. Service2.scala is my server implementation and is working. AkkaHttpClient.scala is the client implementation and it is incomplete.
To build, pls use Gradle as the build.sbt is not up-to-date.
Thanks.
Upvotes: 8
Views: 2807
Reputation: 382
Akka HTTP now has the ability to do this transparently.
http://doc.akka.io/docs/akka-http/current/scala/http/common/json-support.html
Upvotes: 0