Exemplo n.º 1
0
        public AkkaHealthCheck(HealthCheckSettings settings, ExtendedActorSystem system)
        {
            Settings = settings;

            if (!settings.Misconfigured)
            {
                LivenessProvider  = TryCreateProvider(settings.LivenessProbeProvider, system);
                ReadinessProvider = TryCreateProvider(settings.ReadinessProbeProvider, system);
            }
            else // if we are misconfigured
            {
                LivenessProvider  = new MisconfiguredLivenessProvider(system);
                ReadinessProvider = new MisconfiguredReadinessProvider(system);
            }

            // start the probes
            LivenessProbe  = system.SystemActorOf(LivenessProvider.ProbeProps, "healthcheck-live");
            ReadinessProbe = system.SystemActorOf(ReadinessProvider.ProbeProps, "healthcheck-readiness");

            // Need to set up transports (possibly)
            LivenessTransportActor = StartTransportActor(Settings.LivenessTransportSettings, system, ProbeKind.Liveness,
                                                         LivenessProbe);

            ReadinessTransportActor = StartTransportActor(Settings.ReadinessTransportSettings, system,
                                                          ProbeKind.Readiness, ReadinessProbe);
        }
        public AkkaHealthCheck(HealthCheckSettings settings, ExtendedActorSystem system)
        {
            Settings = settings;

            if (settings.LogConfigOnStart)
            {
                system.Log.Info("Liveness Prove Provider: {0}", Settings.LivenessProbeProvider);
                system.Log.Info("Liveness Transport Type: {0}", Settings.LivenessTransport.ToString());
                system.Log.Info(Settings.LivenessTransportSettings.StartupMessage);
                system.Log.Info("Readiness Prove Provider: {0}", Settings.ReadinessProbeProvider);
                system.Log.Info("Readines Transport Type: {0}", Settings.ReadinessTransport.ToString());
                system.Log.Info(Settings.ReadinessTransportSettings.StartupMessage);
            }

            if (!settings.Misconfigured)
            {
                if (settings.LogConfigOnStart)
                {
                    system.Log.Info("Settings Correctly Configured");
                }
                LivenessProvider  = TryCreateProvider(settings.LivenessProbeProvider, system);
                ReadinessProvider = TryCreateProvider(settings.ReadinessProbeProvider, system);
            }
            else // if we are misconfigured
            {
                if (settings.LogConfigOnStart)
                {
                    system.Log.Info("Settings Misconfigured");
                }
                LivenessProvider  = new MisconfiguredLivenessProvider(system);
                ReadinessProvider = new MisconfiguredReadinessProvider(system);
            }

            // start the probes
            LivenessProbe  = system.SystemActorOf(LivenessProvider.ProbeProps, "healthcheck-live");
            ReadinessProbe = system.SystemActorOf(ReadinessProvider.ProbeProps, "healthcheck-readiness");

            // Need to set up transports (possibly)
            LivenessTransportActor = StartTransportActor(Settings.LivenessTransportSettings, system, ProbeKind.Liveness,
                                                         LivenessProbe, Settings.LogInfoEvents);

            ReadinessTransportActor = StartTransportActor(Settings.ReadinessTransportSettings, system,
                                                          ProbeKind.Readiness, ReadinessProbe, Settings.LogInfoEvents);
        }