我对 Azure Service Fabric 非常陌生。
我的场景是我有一个长时间运行的服务,我需要动态启动/停止多个实例,并且启动应该是非阻塞的。每个实例将独立处理 1 个数据条目。例如:
假设我有一个气象服务,它不断提取每个城市的气象数据,并且长期运行。我有一个可以改变的城市列表。所以,我想做以下事情:
var weatherSvcList = new List...
var currentCities = [];
while (true)
{
var newCities = FetchCities();
var addedCities = newCities.Except(currentCities);
weatherSvcList = LaunchSvc(addedCities); // launch and return, non-blocking
var removedCities = currentCities.Except(newCities);
weatherSvcList = StopSvc(removedCities);
weatherSvcList = RelaunchErrorSvc(cities);
currentCities = newCities;
}
我研究了 Actor 模型,但似乎 Actor 不适合长时间运行的任务,而且很难启动/停止它们。知道我应该使用什么服务/编程模型吗?