Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1367

Akka stream for returning single json objects

$
0
0

Hello there,
I use akka http and the stream API and i would like to return only one element as a json object to the client but the server wrap the object inside an array.

[
    {
        "items": []
    }
]

With this code:

path( "service") {
      post {
        entity(as[FeedRequest]) { fr =>
          complete(
            Source.single(ElasticResponse(Nil))
          )
        }
      }
    }

Do you have a solution to return a single value?

I use akka stream for the back pressure because my service depends on some other http services that might be slow. Is akka stream a good choice to solve this problem?

Thank you

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1367

Trending Articles