protected override void OnReceive(object message)
{
Terminated terminated;
if (message.Equals("leave"))
{
Context.Watch(_region);
_region.Tell(GracefulShutdown.Instance);
}
else if ((terminated = message as Terminated) != null && terminated.ActorRef.Equals(_region))
{
//_cluster.RegisterOnMemberRemoved(() => Context.System.Shutdown());
_cluster.Leave(_cluster.SelfAddress);
}
}
}