Chaitanya, that would be really useful, thanks, I will look forward to seeing the code. It is strange that gRPC does not have asynchronous stream support, you would think this kind of listener/observe pattern would be a pretty popular feature.
John On Thursday, June 15, 2017 at 12:55:10 AM UTC-4, Chaitanya Gangwar wrote: > > Hi John, > > When i was working on this, there was no example in grpc package to do the > same. Actually, what you need here is asynchronous streaming, but in > examples, there are 2 variant, one is synchronous stream (routeguide) and > normal async rpc (helloworld). You have to understand both the examples and > need to implement async stream yourself. I may have some poc code with me > where i tested this functionality. Ill check my repo and will post it to > you. May be that will be of some help for you. > > Thanks > Chaitanya > > On Thu, Jun 15, 2017 at 12:38 AM, John Coffey <[email protected] > <javascript:>> wrote: > >> Josh/Chaitanya, I have a similar application - are there any C++ examples >> that do this kind of thing? I just posted a new question to the newsgroup >> asking and then I found this thread. >> >> John >> >> On Friday, January 22, 2016 at 4:53:42 PM UTC-5, Josh Humphries wrote: >>> >>> There is an example of streaming, at least in a proto file: >>> >>> https://github.com/grpc/grpc/blob/master/examples/protos/hellostreamingworld.proto >>> In this case, the server is expected to just immediately send the >>> requested number of messages. >>> >>> >>> Assuming you had some "registry" of streams that represent clients to >>> which you forward data: >>> >>> In your server implementation, you'd just register the StreamObserver >>> (that's what its called in the Java runtime >>> <https://github.com/grpc/grpc-java/blob/master/stub/src/main/java/io/grpc/stub/StreamObserver.java> >>> >>> anyway). >>> >>> Here's example generated code for an endpoint with a streaming response: >>> https://github.com/grpc/grpc-java/blob/master/examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java#L80 >>> (That's the interface you implement on the server.) >>> >>> When your server receives data from whatever other source, it can >>> consult this registry of streams and then call onNext to send the client(s) >>> data. Unregister when the stream errors or when you close the stream. You >>> close it via calling onComplete or onError (latter will send error code to >>> the client). >>> >>> >>> >>> ---- >>> *Josh Humphries* >>> Manager, Shared Systems | Platform Engineering >>> Atlanta, GA | 678-400-4867 >>> *Square* (www.squareup.com) >>> >>> On Fri, Jan 22, 2016 at 3:51 PM, Chaitanya Gangwar < >>> [email protected]> wrote: >>> >>>> Thanks josh for the reply. So for this case i need both async server >>>> and client. sync rpc will not work. please correct me if i am wrong. also >>>> do we have any example which i can look into. i checked async helloworld >>>> but that is simple rpc do we have any example for async stream rpc. >>>> >>>> On Friday, 22 January 2016 12:28:18 UTC-8, Chaitanya Gangwar wrote: >>>>> >>>>> Hi, >>>>> >>>>> I have a requirement, where multiple clients send (register) a >>>>> request to server and continue, whenever server have data, server will >>>>> push >>>>> the data to clients. it may be possible that server may not have data at >>>>> present and will keep pushing data whenever it has. Some other thread is >>>>> providing the data to server. >>>>> >>>>> Can i do this with grpc without blocking the server and client. What i >>>>> understand from grpc streaming is that client will be waiting for data >>>>> till >>>>> server sends out the data and after receiving the data it closes the >>>>> connection. >>>>> >>>>> please help, if i can do this using grpc and if yes how should i >>>>> design this. >>>>> >>>>> thanks >>>>> Chaitanya >>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "grpc.io" 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]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/grpc-io/586023c6-8a37-4662-a592-0047b7c916d4%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/grpc-io/586023c6-8a37-4662-a592-0047b7c916d4%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "grpc.io" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/grpc-io/FKeg4yfB-Jo/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/grpc-io. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/grpc-io/3533c9ab-ad6a-4566-9e49-ed438d565eb3%40googlegroups.com >> >> <https://groups.google.com/d/msgid/grpc-io/3533c9ab-ad6a-4566-9e49-ed438d565eb3%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "grpc.io" 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 https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/15c847d8-5111-410b-8ddf-912bbc631135%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
