Using ASP.NET Core microservices, both API and worker roles, running in Azure Service Fabric. We use Service Bus to do inter-microservice communication.
Consider the following situation; Each microservice holds a local, in-mem copy of cached objects of type X. One worker role is responsible for processing a message that would result in a rebuild of this cache for all instances. We are having multiple nodes, and thus multiple instances of each microservice in Service Fabric.
What would be the best approach to trigger this update? I though of the following approaches:
- Calling SF for all service replica's and firing an HTTP POST on each replica to trigger the update
- This however does not seem to work as worker roles don't expose any APIs
- Creating a specific 'broadcast' topic where each instance registers a subscription for, and thus using pub/sub mechanism
- I fail to see how I can make sure each instance has it's own subscription, but also I don't end up with ghost subscriptions when something happens like a crash