Azure / service-fabric-mesh-preview

Service Fabric Mesh is the Service Fabric's serverless offering to enable developers to deploy containerized applications without managing infrastructure. Service Fabric Mesh , aka project “SeaBreeze” is currently available in private preview. This repository will be used for tracking bugs/feature requests as GitHub issues and for maintaining the latest documentation.
MIT License
82 stars 12 forks source link

Question: How to gracefully shutdown? #291

Closed aloneguid closed 5 years ago

aloneguid commented 5 years ago

In "classic" Service Fabric services receive cancellation token request so they know they have to shutdown gracefully. Provided that all we have now is static void Main(string[] args) how would service gracefully shutdown?

mikkelhegn commented 5 years ago

Your container will receive a SIGTERM, so hooking in to the event .NET raises would be the equivalent. A few references: https://stackoverflow.com/questions/38291567/killing-gracefully-a-net-core-daemon-running-on-linux and https://docs.microsoft.com/en-us/dotnet/api/system.appdomain.processexit?view=netcore-2.0

aloneguid commented 5 years ago

Thank you, tried and works for me.