Based on the documentation sample, the proxy is created like this:
IMyService helloWorldClient = ServiceProxy.Create<IMyService>(new
Uri("fabric:/MyApplication/MyHelloWorldService"));
string message = await helloWorldClient.HelloWorldAsync();
But providing I need to limit the max amount of response time I would normally create CancellationToken and pass it down to the call. Is there a way how to pass the token to proxy so it cancels waiting for the result from remote service?
You can do this in V2 stack, I haven't tried the V1 stack but it might work there too. Add a parameter of CancellationToken type to the method signature:
this token will then get passed to ServicePartitionClient.InvokeWithRetryAsync method via the proxy.
The generated proxy method will look like the following:
Without the CancellationToken parameter the proxy method looks like:
If you want to inspect the generated proxy assembly use the following attribute in the EntryPoint assembly or the assembly that has the service interface defined: