/// <summary>
        /// Configuration of the Heartbeat functionality
        /// </summary>
        public LiteServerConfiguration Heartbeat(Action <HeartbeatConfiguration> heartbeat)
        {
            if (heartbeat == null)
            {
                throw new ArgumentNullException(nameof(heartbeat));
            }

            HeartbeatConfiguration instance = null;

            Application.Extensibility(extensibility =>
            {
                instance = extensibility.Register(() => new HeartbeatConfiguration(this, _configuration));
            });

            heartbeat.Invoke(instance);

            return(this);
        }
예제 #2
0
        internal HeartbeatLoggingConfiguration(HeartbeatConfiguration heartbeat, InternalConfiguration configuration)
        {
            if (heartbeat == null)
            {
                throw new ArgumentNullException(nameof(heartbeat));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            _configuration = configuration;

            Heartbeat = heartbeat;

            // Default is logging every 5th minute
            Interval(TimeSpan.FromMinutes(5));

            // Default repository
            Repository <ConfigurationServiceBasedHeartbeatLoggingRepository>();
        }
예제 #3
0
        public HeartbeatService(HeartbeatConfiguration configuration)
        {
            _configuration = configuration;

            _timer = new Timer(Heartbeat, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(_configuration.Interval));
        }