Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consuming akka-http JSON streaming does not seem to work with akka-http-circe #204

Open
akauppi opened this issue May 2, 2018 · 6 comments

Comments

@akauppi
Copy link

akauppi commented May 2, 2018

I got server side working, but have problems with the client side.

https://doc.akka.io/docs/akka-http/current/common/json-support.html#consuming-json-streaming-style-apis

The akka-http samples are made with Spray-json. I'm trying to replicate the same, using Circe and akka-http-circe.

Note: This is just an early warning. Looking into what's the problem, precisely (so I can expose a repo that showcases it, in a few days).

@akauppi
Copy link
Author

akauppi commented May 3, 2018

The code is available (I'm implying I could use some help...) here: https://github.com/akauppi/akka-http-circe-streaming-sample

Compilation fails with:

Error:(54, 54) could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.Unmarshaller[akka.util.ByteString,sandbox.Data]
            .mapAsync(1)(bytes => Unmarshal(bytes).to[Data])
Error:(54, 54) not enough arguments for method to: (implicit um: akka.http.scaladsl.unmarshalling.Unmarshaller[akka.util.ByteString,sandbox.Data], implicit ec: scala.concurrent.ExecutionContext, implicit mat: akka.stream.Materializer)scala.concurrent.Future[sandbox.Data].
Unspecified value parameters um, mat.
            .mapAsync(1)(bytes => Unmarshal(bytes).to[Data])

@hseeberger
Copy link
Owner

Thanks. I don't have the time to investigate this now.
BTW, for you use case you might also take a look at Server-Sent Events and in particular to the SSE support in Alpakka.

@akauppi
Copy link
Author

akauppi commented May 3, 2018

No problem. I got the hop running, and my question rather is whether you see this to be within the scope of akka-http-circe, or not.

I hope you do. :) Akka-http-json is the "go to" place for integrating e.g. Circe with akka-http, and it's so nice when things just work. Since Akka HTTP now provides support for JSON streaming (and since the server side already works), it would make sense to allow also the client side to do so.

For me, that meant doing this unmarshaller (link).

I don't have the chance to make a proper PR right now, but if you see the feature as a welcome inclusion, I may do so later (within some weeks, or a month).

@hseeberger
Copy link
Owner

Yeah, entity streaming is definitely a missing feature. Please give it a try.

@akauppi
Copy link
Author

akauppi commented May 6, 2018

Thanks for mentioning Server-Sent Events. I may be using those in my actual case, but let's return to this at some point.

@gabfssilva
Copy link
Contributor

I guess #347 solved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants