Skip to content

InProcessTestCluster.MigrateAsync(GrainId, SiloAddress?)

MigrateAsync(GrainId, SiloAddress?)

View source
public Task MigrateAsync(GrainId grainId, 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

grainIdGrainId
The ID of 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);