Ejemplo n.º 1
0
        public ClusterLivenessProbe(LivenessStatus livenessStatus)
        {
            _livenessStatus = livenessStatus;

            Receive <LivenessStatus>(s =>
            {
                _livenessStatus = s;
                foreach (var sub in _subscribers)
                {
                    sub.Tell(s);
                }
            });

            Receive <GetCurrentLiveness>(_ => Sender.Tell(_livenessStatus));

            Receive <SubscribeToLiveness>(s =>
            {
                _subscribers.Add(s.Subscriber);
                Context.Watch(s.Subscriber);
                s.Subscriber.Tell(_livenessStatus);
            });

            Receive <UnsubscribeFromLiveness>(u =>
            {
                _subscribers.Remove(u.Subscriber);
                Context.Unwatch(u.Subscriber);
            });

            Receive <Terminated>(t => { _subscribers.Remove(t.ActorRef); });
        }
            public CustomProbe(LivenessStatus livenessStatus, ReadinessStatus readinessStatus)
            {
                _livenessStatus  = livenessStatus;
                _readinessStatus = readinessStatus;

                Receive <GetCurrentLiveness>(_ => Sender.Tell(_livenessStatus));
                Receive <GetCurrentReadiness>(_ => Sender.Tell(_readinessStatus));
            }
Ejemplo n.º 3
0
 private void HandleRecoveryStatus(RecoveryStatus status)
 {
     _log.Info("Received recovery status {0} from probe.", status);
     _journalLive       = status.JournalRecovered;
     _snapshotStoreLive = status.SnapshotRecovered;
     _currentStatus     = new LivenessStatus(_journalLive && _snapshotStoreLive, status.ToString());
     PublishStatusUpdates();
 }