1

Below is the service spec:

service Cooler {
    rpc saveThing (stream SaveRequest) returns (SaveReply);
}

I need to stream messages to to Cooler.saveThing(). All the SaveRequests have a common field author and unique fields per a Thing are price and name. How can I send the author only once?

Not working attempt - Multiple inputs

It would be a solution but it is not supported by protobuf yet.

service Cooler {
    rpc saveThing (stream SaveRequest, Author) returns (SaveReply);
}

Not working attempt - Nested message

Every received element of SaveRequest will still contain author and an array of Things.

message SaveRequest {
  message Thing {
    int price = 1;
    string name = 2;
  }

  repeated Thing things = 1;
  string author = 2;
}

Possible solution

Grpc headers.

Question

How can I send the author only once?

Amio.io
  • 20,677
  • 15
  • 82
  • 117
  • 1
    Possible duplicate of [GRPC: Client streaming with configuration message](https://stackoverflow.com/questions/48230577/grpc-client-streaming-with-configuration-message) – Eric Anderson Jan 17 '19 at 16:36

0 Answers0