On Mon, Jul 20, 2015 at 7:26 PM, kkm <[email protected]> wrote:

> I have a service that conceptually takes a large one-time set of
> parameters, then accepts a stream of short messages, and returns a result
> at the end. How do I go about defining such a service? Indeed, I've gone
> through the route_guide sample
> https://github.com/grpc/grpc-common/tree/master/cpp/route_guide.
>
> My head-first attempt resulted in a "syntax error" message complaining
> about the comma:
>
> rpc Recognize(RecognizeRequest, stream Frame) returns (RecognizeReply) {}
>
>
> I could not find any formal language spec (does it exist by the way?), but
> I guess 2 inputs are not supported. So If that is the case, how do I go
> about defining what I need? I can think of defining one "supermessage"
> consisting of an optional
>
> RecognizeRequest and optional Frame, and sending the first only with the 
> first message in the stream. But I can also think of other ways to achieve 
> the same.
>
> You are correct that only one input message type can be specified. Using
two optional fields (RecognizeRequest and Frame) seems the right approach
here. You can define these two fields in an "oneof" so only one of them
will be set at a time:
message Request {
  oneof request_oneof {
     RecognizeRequest recognize_request = 1;
     Frame frame = 2;
  }
}

>
> What is the kosher, canonical way of doing such a one-time input message
> stream set up?
>
>  -kkm
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" 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 http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" 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 http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to