我认为没有内置的克隆支持。但我相信你可以实现自己的机制来做到这一点 - 你可以迭代你的演员来获取他们的状态,然后将它传递给另一个集群。迭代:
`
var cancellationToken = new CancellationToken();
ContinuationToken continuationToken = null;
var actorProxyFactory = new ActorProxyFactory();
var actorServiceProxy = ActorServiceProxy.Create("fabric:/MyActorApp/MyActorService", partitionKey);
do
{
var queryResult = await actorServiceProxy.GetActorsAsync(continuationToken, cancellationToken);
foreach (var item in queryResult.Items)
{
var actor = actorProxyFactory.CreateActorProxy<IMyActor>("fabric:/MyActorApp/MyActorService", item.ActorId);
var state = await actor.GetState();
}
continuationToken = queryResult.ContinuationToken;
} while (continuationToken != null);
`
如果您有演员状态名称的动态列表,您可以使用 GetStateNamesAsync 方法获取所有名称:
IEnumerable<string> stateNames = await StateManager.GetStateNamesAsync();
希望这会有所帮助。