Skip to content

TestCluster.MigrateAsync(IAddressable, SiloAddress?)

MigrateAsync(IAddressable, SiloAddress?)

View source
public Task MigrateAsync(IAddressable grain, SiloAddress? targetSilo = null)
Migrates the current activation of the specified grain to a different silo and waits for migration to complete. If targetSilo is specified, a placement hint is set to guide migration to that silo.

Parameters

grainIAddressable
The grain to migrate.
targetSiloSiloAddress?
The target silo address, or null to let the placement director choose.

Returns

A task that completes when the grain has been migrated (deactivated on the source silo).

Examples

var targetSilo = cluster.GetActiveSilos().First(s => s.SiloAddress != originalHost).SiloAddress;
await cluster.MigrateAsync(grain.GetGrainId(), targetSilo);