Thank you Michael, will check if we can restructure the client to handle 
GRPC_OP_RECV_MESSAGE into a separate batch.

Best, -Ram.

> On Jul 24, 2020, at 11:30 AM, Michael Lumish <[email protected]> wrote:
> 
> The simplest way to handle this is to put the GRPC_OP_RECV_MESSAGE into a 
> separate batch. You can wait for the batch with the metadata, then wait for 
> the message batch. If the server ends the call without sending a message, the 
> message batch will end with a null message.
> 
> On Fri, Jul 24, 2020 at 10:59 AM Ram <[email protected] 
> <mailto:[email protected]>> wrote:
> Any comments on the feasibility of this or other options to explore? Thank 
> you.
> 
> On Wednesday, July 22, 2020 at 10:50:31 AM UTC-7 Ram wrote:
> Team gRPC,
> 
> We've a scenario where a gRPC client sets up all the operations and does a 
> grpc_call_start_batch(), something like this:
> 
> https://github.com/grpc/grpc/blob/master/test/core/end2end/tests/trailing_metadata.cc#L153
>  
> <https://github.com/grpc/grpc/blob/master/test/core/end2end/tests/trailing_metadata.cc#L153>
> memset(ops, 0, sizeof(ops));
> op = ops;
> op->op = GRPC_OP_SEND_INITIAL_METADATA;
> op->data.send_initial_metadata.count = 2;
> ....
> <snip>
> ......
> op->op = GRPC_OP_RECV_INITIAL_METADATA;
> op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
> op->flags = 0;
> op->reserved = nullptr;
> op++;
> op->op = GRPC_OP_RECV_MESSAGE;
> op->data.recv_message.recv_message = &response_payload_recv;
> op->flags = 0;
> op->reserved = nullptr;
> op++;
> ....
> <snip>
> ......
> error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), tag(1),
> nullptr);
> 
> GPR_ASSERT(GRPC_CALL_OK == error);
> 
> In some scenarios, the server side sends only initial metadata whereas in 
> some other scenarios it sends a message as well along with initial metadata 
> and the client isn't aware of when one vs the other scenario happens.
> 
> Is it possible to wake up client (i.e., event posted on the completion queue) 
> to respond to both scenarios? I tried digging around in test subdir, couldn't 
> find my scenario https://github.com/grpc/grpc/tree/master/test 
> <https://github.com/grpc/grpc/tree/master/test> 
> 
> Any pointers or alternative options on this will be of help, thank you!
> 
> Best, -Ram.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "grpc.io <http://grpc.io/>" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/grpc-io/6688642d-3807-4f94-995c-174b985281e8n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/grpc-io/6688642d-3807-4f94-995c-174b985281e8n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/279A445A-A2B2-4F64-BD29-5BDB37D351C5%40gmail.com.

Reply via email to