Call a specific instance of a service in Azure Service Fabric

浪子不回头ぞ 提交于 2019-12-08 05:46:12

问题


In our service fabric application we have a service that requires keeping some data in memory during operation to optimise performance, however in some rare cases we need to clear this data.

So at some point, a call comes to this service and tells it to empty its cache. The problem arises that we may have several instances of this service, and when you call a service (from another service) in service fabric the call only ends up going to one instance. I need a to call all instances of this service.

We connect to our services (using a generic method) like so:

T service = ServiceProxy.Create<T>(serviceUri);

Is there a way to specify an instance of the service to use? Or some other way to get a message to all instances of a service?

Thanks


回答1:


This seems like a perfect use case for Service Fabric Pub/Sub. Just have all the services that need to clear their in data memory be subscribers, and then your calling service can publish the message which will broadcast to all subscribing services.

See more here: https://github.com/loekd/ServiceFabric.PubSubActors.



来源:https://stackoverflow.com/questions/40532285/call-a-specific-instance-of-a-service-in-azure-service-fabric

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!