Closed IndikaUdagedara closed 5 years ago
Where would you be checking the status from? A derived class? That class would be implementing the workflow anyways, why not set its own completion flag?
Thanks.
Yes, I guess I could add a flag in the derived class. In my case I have couple of BackgroundService
s and there's another service which looks at the completion status of those services and performs an action. I was hoping I could do something like
await Task.WhenAll(service1.ExecutingTask, service2.ExecutingTask, ...)
from this monitoring service to see if the other services have completed.
May be this flag for completion status can be an interface method/property in IHostedService
? -- it only has StartAsync
and StopAsync
methods but no way to indicate if the service is completed. Or do you have any other suggestions to implement this pattern?
When using
BackgroundService
, I have a requirement to know if the work is completed (I assume it is a common requirement).This could be achieved if the
_executingTask
member isprotected
. Or is there another way to determine completion status?