I've been using stateless service programming model but I haven't really override the RunAsync method to run application logic. When would you normally override this method?
When or what's the best use to override RunAsync method of Stateless service in Service Fabric
1.4k views Asked by alltej At
1
Services can have both autonomous behavior and interactive behavior.
You can use
CreateServiceInstanceListeners
to create a communication listener, which allows interaction with your service.Your service might (also) need to perform background tasks (not triggered by external callers). For example, it could be monitoring a Queue. You can use
RunAsync
for that, in there you'd start an endless loop. In the loop you would check theCancellationToken
and then check the Queue for items and process them.Other examples (without loops) are:
An example is here.