Пример #1
0
        public BeatPulseContext AddLiveness(IBeatPulseLivenessRegistration registration)
        {
            if (registration == null)
            {
                throw new ArgumentNullException(nameof(registration));
            }

            var path = registration.Path;

            if (!string.IsNullOrEmpty(path))
            {
                if (!_registeredLiveness.ContainsKey(path))
                {
                    _registeredLiveness.Add(path, registration);
                }
                else
                {
                    throw new InvalidOperationException($"The path {path} is already configured.");
                }

                return(this);
            }
            else
            {
                throw new InvalidOperationException("The global path is automatically used for beat pulse.");
            }
        }
Пример #2
0
 internal static LivenessExecutionContext FromRegistration(IBeatPulseLivenessRegistration registration, bool showDetailedErrors)
 {
     return(new LivenessExecutionContext()
     {
         Name = registration.Name,
         Path = registration.Path
     });
 }
Пример #3
0
 internal static LivenessExecutionContext FromRegistration(IBeatPulseLivenessRegistration registration, bool isDevelopment)
 {
     return(new LivenessExecutionContext()
     {
         IsDevelopment = isDevelopment,
         Name = registration.Name,
         Path = registration.Path
     });
 }
Пример #4
0
 internal IBeatPulseLiveness CreateLivenessFromRegistration(IBeatPulseLivenessRegistration registration)
 {
     return(registration.GetOrCreateLiveness(_serviceProvider));
 }