You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Back pressure** is supported via [Manual Flow Control](https://github.com/grpc/grpc-java/tree/master/examples/src/main/java/io/grpc/examples/manualflowcontrol)
90
90
* Related Reading: [Understanding Reactive gRPC Flow Control](https://github.com/salesforce/reactive-grpc#back-pressure)
91
-
***Cooperative cancellation**is propagated across network boundaries. Meaning a cancelled client ```coroutineContext``` attached to a stub will cancel the related rpc job within the service impl.
91
+
***Cooperative cancellation** across network boundaries.
92
92
<a></a>
93
93
* Client Stubs
94
94
* Implement ```CoroutineScope``` interface
95
95
* Designed to work well with **Structured Concurrency**
96
+
* Cancellation of the client `CoroutineScope` will propagate to the server.
96
97
* Cancellations can now be propagated across usages of a specific stub instance.
97
98
* Rpc methods are overloaded with inline builders for request types
99
+
* The request parameter for rpc methods defaults to `RequestType.defaultsInstance`
100
+
98
101
99
102
```kotlin
100
103
val stub =GreeterCoroutineGrpc.newStub(channel)
@@ -107,10 +110,9 @@ stub.sayHello { name = "John" }
107
110
* Rpc calls are wrapped within a scope initialized with the following context elements.
108
111
*```CoroutineName``` set to ```MethodDescriptor.fullMethodName```
109
112
*```GrpcContextElement``` set to ```io.grpc.Context.current()```
110
-
* Base services implement ```CoroutineScope``` only as a means to allow overriding the initial ```coroutineContext```
111
-
* The initial ```coroutineContext``` defaults to ```EmptyCoroutineContext```
112
-
* A common case for overriding the default context is for setting up application specific ```ThreadContextElement``` or ```CoroutineDispatcher```, such as ```MDCContext()``` or ```newFixedThreadPoolContext(...)```
113
-
* Rpc method implementation **MUST** be wrapped in a ```coroutineScope{}``` builder. Future versions of Kotlin will show a warning in the ide for ambiguous scope resolution. [KT-27493](https://youtrack.jetbrains.com/issue/KT-27493). It also ensures that the proper ```coroutineContext``` is used during method execution.
113
+
* Base services implement ```ServiceScope``` and allow overriding the initial ```coroutineContext``` used for each rpc method invocation.
114
+
* Each services ```initialContext``` defaults to ```EmptyCoroutineContext```
115
+
* A common case for overriding the ```initialContext``` is for setting up application specific ```ThreadContextElement``` or ```CoroutineDispatcher```, such as ```MDCContext()``` or ```newFixedThreadPoolContext(...)```
0 commit comments