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

Add mapping streaming APIs to newline-delimited JSON streams #38

Closed
arturgspb opened this issue Nov 4, 2019 · 6 comments
Closed

Add mapping streaming APIs to newline-delimited JSON streams #38

arturgspb opened this issue Nov 4, 2019 · 6 comments

Comments

@arturgspb
Copy link

This issue copy of cloudendpoints/esp#728

Hi!
Please consider adding feature newline-delimited JSON streams like in https://github.com/grpc-ecosystem/grpc-gateway

Example exists in grpc-ecosystem/grpc-gateway#581

This would be useful if api return 100k + lines of statistics on advertising objects without loading everything into memory. =) I really want to use the protocol for exchanging such data, but now, unfortunately, I can’t. Of course, there may be problems with the performance of serialization and deserialization, I am ready to discuss this, maybe it is possible to solve the problem differently.

In general, I would like to have api based on the protocol of buffers, use authorization check at the esp level, also in some api sometimes it is necessary to give a large flow of data (we usually have statistics), while from the external system I already getting stream with 100k + CSV for one request time ( for example Google Ads) and I want to immediately redirect them to the output stream, possibly with minimal processing and json mapping. I don’t want to save data to a cloud guard or something like that and give a link to the data. I want to immediately serialize the answer. Certainly in Google it is already somehow decided, maybe you can tell how to do it correctly from the point of view of Google?

Thank you in advance!

@qiwzhang
Copy link
Member

qiwzhang commented Nov 4, 2019

I like to see it is implemented as:

  1. define a new struct

struct JsonResponseTranslateOption {
::google::protobuf::util::JsonPrintOptions& json_print_options;
bool stream_newline_delimted;
};

replace this for the last parameter of ResponseToJsonTranslator

  1. all implementation should be in this file

  2. please add unit_test for it.

You are welcomed to contribute to such change.

@qiwzhang
Copy link
Member

qiwzhang commented Nov 4, 2019

@lizan like to you your input on this.

@arturgspb
Copy link
Author

I don't write in C++ =(

@NAlexPear
Copy link
Contributor

@qiwzhang @arturgspb in case anyone's interested, I've taken a stab at implementing this in #73. It's an old thread, but the lack of newline-delimited JSON on streaming endpoints is a major pain point for my own use of gRPC transcoding!

@alechenninger
Copy link

It looks like this issue can be closed?

@arturgspb
Copy link
Author

I think yes, since many alternative tools have appeared since 2019.

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

4 participants