Azure-Samples / service-fabric-dotnet-getting-started

Get started with Service Fabric with these simple introductory sample projects.
MIT License
230 stars 329 forks source link

[Info requested] What is the purpose of CancellationToken in reliable actors #63

Open murdockcrc opened 7 years ago

murdockcrc commented 7 years ago

Hi,

In the sample app's Actor sample, you can find this line: public async Task StartProcessingAsync(CancellationToken cancellationToken)

The token is never used in the method though.

Also, upon creating the actor's proxy, I notice the parameter passed is CancellationToke.None.

Can you please comment on the purpose of cancellation tokens in the context of Reliable Actors?

kbulte commented 6 years ago

Hi,

When you create a new Actor the generated code passes CancellationToken in the actor methods but all the Azure samples about actors don't use CancellationToken.

Can someone explain this please.

raunakpandya commented 6 years ago

Basically the samples aren’t just using it as these are just 'samples' :) . However in your own implementation of these actor methods, you may want to use them. All actor methods can be implemented in an async way and you can signal the token from the client and your method on server will have the token signaled.