Hello there,
We don't have any examples right now outside of our tests, but let me 
respond to both questions here:

1. In the first case, why mix sync and async? In the C++ API both unary and 
streaming calls support sync or async APIs. That said, if you want to mark 
one of the methods async, just derive your service implementation from the 
WithAsyncMethod_METHODNAME version of the service. I agree that the code 
expansion can be ugly if we need to mark a lot of methods async.

2.  Yes, the sync API provides its own threadpool but you have to provide 
your own thread(s) for processing in the case of async. If a service mixes 
sync and async methods, gRPC's own threadpool will invoke the method 
handlers for the sync methods but you have to use your own thread(s) for 
processing the async methods.

Thanks and best regards!

-vjpai

On Thursday, February 8, 2018 at 6:58:22 AM UTC-8, aaj...@gmail.com wrote:
>
> I too would be interested in a more straightforward example that isn't so 
> tied to the GRPC test framework.
>
> Also it would be helpful to understand the threading implications of a C++ 
> service that mixes sync and async methods. My understanding is that a 
> thread pool is provided for sync services but you have to provide your own 
> threading model to wait on the completion queue for async services. What is 
> the end result when a service mixes async and sync methods?
>
>
> On Monday, October 30, 2017 at 8:01:33 PM UTC-4, christop...@gmail.com 
> wrote:
>>
>> Are there any standalone examples of doing this for C++ servers?  This 
>> issue (https://github.com/grpc/grpc/issues/4285) points to 
>> test/cpp/end2end/hybrid_end2end_test.cc as examples of doing this.
>>
>> My use case is a service comprised mostly of unary rpcs, but also 
>> supporting a server streaming rpc where one or more clients can register to 
>> receive future events from the server over a long-running connection.  
>> Was hoping to find an example that isn't as tightly coupled with the GRPC 
>> test framework.
>>
>> Thanks in advance!
>>
>>     Chris
>>
>
On Thursday, February 8, 2018 at 6:58:22 AM UTC-8, aaj...@gmail.com wrote:
>
> I too would be interested in a more straightforward example that isn't so 
> tied to the GRPC test framework.
>
> Also it would be helpful to understand the threading implications of a C++ 
> service that mixes sync and async methods. My understanding is that a 
> thread pool is provided for sync services but you have to provide your own 
> threading model to wait on the completion queue for async services. What is 
> the end result when a service mixes async and sync methods?
>
>
> On Monday, October 30, 2017 at 8:01:33 PM UTC-4, christop...@gmail.com 
> wrote:
>>
>> Are there any standalone examples of doing this for C++ servers?  This 
>> issue (https://github.com/grpc/grpc/issues/4285) points to 
>> test/cpp/end2end/hybrid_end2end_test.cc as examples of doing this.
>>
>> My use case is a service comprised mostly of unary rpcs, but also 
>> supporting a server streaming rpc where one or more clients can register to 
>> receive future events from the server over a long-running connection.  
>> Was hoping to find an example that isn't as tightly coupled with the GRPC 
>> test framework.
>>
>> Thanks in advance!
>>
>>     Chris
>>
>

-- 
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 grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
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/676db580-92c0-4728-aff7-0449ea695b41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to