public HeartbeatServiceTests()
 {
     _validateApplicationTokenService = A.Fake <IValidateApplicationTokenService>();
     _dataStore          = A.Fake <IDataStore>();
     _compassEnvironment = A.Fake <ICompassEnvironment>();
     _sut = new HeartbeatService(_validateApplicationTokenService, _dataStore, _compassEnvironment);
 }
Esempio n. 2
0
        public Initialisor(IBus bus, IBus eventProcessingBus)
        {
            if (bus == null)
            {
                throw new ArgumentNullException("bus");
            }

            _bus = bus;
            _eventProcessingBus = eventProcessingBus;
            _membershipService  = new MembershipService(_bus);

            _s3Config = AwsConfigFactory.GetS3Config();
            var awsClientFactory = new AwsClientFactory();

            _fileStore = new S3FileStore(awsClientFactory);

            var dynamoDbConfig      = AwsConfigFactory.GetDynamoDbConfig();
            var mediaRepository     = new MediaRepository(dynamoDbConfig, awsClientFactory);
            var uniquNameRepository = new UniqueNameRepository(dynamoDbConfig, awsClientFactory);

            _mediaService = new MediaService(_bus, mediaRepository, uniquNameRepository, _fileStore);


            _heartbeatService = new HeartbeatService(_bus, ServerSettings.ServerName);
            _heartbeatService.Start();

            AutoMapperConfiguration.Configure();
        }
Esempio n. 3
0
 public DynDns53ConsoleClient(IConfigHandler configHandler, IAmazonRoute53 route53Client, IHeartbeatService heartbeatService, ILog logger)
 {
     this.configHandler    = configHandler;
     this.route53Client    = route53Client;
     this.heartbeatService = heartbeatService;
     this.logger           = logger;
 }
Esempio n. 4
0
 public KinesisShardReaderBase(IAmazonKinesis client,
                               ICheckpointRepository checkpointRepository,
                               IHeartbeatService heartbeatService)
 {
     _client = client;
     CheckpointRepository = checkpointRepository;
     HeartbeatService     = heartbeatService;
 }
Esempio n. 5
0
 /// <summary>
 /// Initialises the object. This is called within a lock, do not call Initialise from
 /// within this.
 /// </summary>
 protected virtual void DoInitialise()
 {
     _Clock                      = Factory.Singleton.Resolve <IClock>();
     _PrivateHeartbeat           = Factory.Singleton.Resolve <IHeartbeatService>();
     _PrivateHeartbeat.FastTick += Heartbeat_FastTimerTicked;
     _PrivateHeartbeat.SlowTick += Heartbeat_SlowTimerTicked;
     _PrivateHeartbeat.Start();
 }
 public HeartbeatJob(IHeartbeatService hearbeat)
 {
     if (hearbeat == null)
     {
         throw new ArgumentNullException("hearbeat");
     }
     _hearbeat = hearbeat;
 }
Esempio n. 7
0
        /// <summary>
        /// Creates a new object.
        /// </summary>
        /// <param name="expireMilliseconds"></param>
        /// <param name="millisecondsBetweenChecks"></param>
        public ExpiringCollection(int expireMilliseconds, int millisecondsBetweenChecks)
        {
            ExpireMilliseconds        = expireMilliseconds;
            MillisecondsBetweenChecks = millisecondsBetweenChecks;

            _Clock            = Factory.Singleton.Resolve <IClock>();
            _HeartbeatService = Factory.Singleton.ResolveSingleton <IHeartbeatService>();
        }
Esempio n. 8
0
 public HeartbeatJob(IHeartbeatService hearbeat, IActionContext actionContext, AuthenticatorService authenticatorService)
     : base(actionContext, authenticatorService)
 {
     if (hearbeat == null)
     {
         throw new ArgumentNullException(nameof(hearbeat));
     }
     _hearbeat = hearbeat;
 }
Esempio n. 9
0
 public ServiceHeartBeatJob(IHeartbeatService hearbeat, IHRAMServicesService iHRAMServicesService)
 {
     if (hearbeat == null)
     {
         throw new ArgumentNullException(nameof(hearbeat));
     }
     _hearbeat = hearbeat;
     this._IHRAMServicesService = iHRAMServicesService;
 }
Esempio n. 10
0
 public ServerStatusCheckerJob(IHeartbeatService hearbeat, IStoreServerService iStoreServerService)
 {
     if (hearbeat == null)
     {
         throw new ArgumentNullException(nameof(hearbeat));
     }
     _hearbeat = hearbeat;
     this._IStoreServerService = iStoreServerService;
 }
 public ProcessedMeasurementsKinesisShardReader(IAmazonKinesis client,
                                                ICheckpointRepository checkpointRepository,
                                                IHeartbeatService heartbeatService,
                                                IBus bus,
                                                ILogger logger)
     : base(client, checkpointRepository, heartbeatService)
 {
     _bus    = bus;
     _logger = logger;
 }
 public ProcessedMeasurementsShardReaderFactory(ICheckpointRepository checkpointRepository,
                                                IHeartbeatService heartbeatService,
                                                IBus bus,
                                                ILogger logger)
 {
     _checkpointRepository = checkpointRepository;
     _heartbeatService     = heartbeatService;
     _bus    = bus;
     _logger = logger;
 }
 public AwsKinesisFactory(IAwsClientFactory clientFactory,
                          IOptions <AwsSettings> awsOptions,
                          IHeartbeatService heartbeatService,
                          ILogger logger)
 {
     _clientFactory    = clientFactory;
     _heartbeatService = heartbeatService;
     _logger           = logger;
     _awsSettings      = awsOptions.Value;
 }
        /// <summary>
        /// See base docs.
        /// </summary>
        /// <param name="view"></param>
        public override void Initialise(IBackgroundThreadQueuesView view)
        {
            base.Initialise(view);

            var heartbeatService = Factory.Singleton.ResolveSingleton <IHeartbeatService>();

            heartbeatService.FastTick += HeartbeatService_FastTick;
            _HeartbeatService          = heartbeatService;

            ShowQueues();
        }
Esempio n. 15
0
        /// <summary>
        /// Creates a new object.
        /// </summary>
        public NetworkConnector() : base()
        {
            UseKeepAlive          = true;
            IdleTimeout           = DefaultIdleTimeout;
            _LastIdleCheck        = DateTime.UtcNow;
            _LastEstablishedCheck = _LastIdleCheck;

            _TcpConnectionService       = Factory.Singleton.Resolve <ITcpConnectionStateService>();
            _HeartbeatService           = Factory.Singleton.Resolve <IHeartbeatService>().Singleton;
            _HeartbeatService.FastTick += HeartbeatService_FastTick;
        }
Esempio n. 16
0
 public RawMeasurementsKinesisShardReader(IAmazonKinesis client,
                                          ICheckpointRepository checkpointRepository,
                                          IHeartbeatService heartbeatService,
                                          IProcessedMeasurementStreamWriter processedMeasurementStreamWriter,
                                          IRecordProcessor recordProcessor,
                                          ILogger logger)
     : base(client, checkpointRepository, heartbeatService)
 {
     _processedMeasurementStreamWriter = processedMeasurementStreamWriter;
     _recordProcessor = recordProcessor;
     _logger          = logger;
 }
Esempio n. 17
0
 public Processor(LoggerFactory loggerFactory, ISettings settings, IImageProcessor imageProcessor, IWittyPiService wittyPiService,
                  INtpService ntpService, IStopCheckService stopCheckService, IAirQualityProcessor airQualityProcessor, IHeartbeatService heartbeatService)
 {
     this.logger              = loggerFactory(nameof(Processor));
     this.settings            = settings;
     this.imageProcessor      = imageProcessor;
     this.wittyPiService      = wittyPiService;
     this.ntpService          = ntpService;
     this.stopCheckService    = stopCheckService;
     this.airQualityProcessor = airQualityProcessor;
     this.heartbeatService    = heartbeatService;
 }
Esempio n. 18
0
 /// <summary>
 /// See base docs.
 /// </summary>
 /// <param name="disposing"></param>
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing)
     {
         if (_HeartbeatService != null)
         {
             _HeartbeatService.FastTick -= HeartbeatService_FastTick;
         }
         _HeartbeatService = null;
     }
 }
Esempio n. 19
0
 public RawMeasurementsShardReaderFactory(IRecordProcessorFactory recordProcessorFactory,
                                          IProcessedMeasurementStreamWriter processedMeasurementStreamWriter,
                                          ICheckpointRepository checkpointRepository,
                                          IHeartbeatService heartbeatService,
                                          ILogger logger)
 {
     _recordProcessorFactory           = recordProcessorFactory;
     _processedMeasurementStreamWriter = processedMeasurementStreamWriter;
     _checkpointRepository             = checkpointRepository;
     _heartbeatService = heartbeatService;
     _logger           = logger;
 }
Esempio n. 20
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void Initialise()
        {
            lock (_SyncLock) {
                if (_HeartbeatService == null)
                {
                    _NextSnapshot = DateTime.UtcNow.AddSeconds(SnapshotInterval);
                    FullPath      = Path.Combine(Factory.ResolveSingleton <IConfigurationStorage>().Folder, FileName);

                    _HeartbeatService           = Factory.ResolveSingleton <IHeartbeatService>();
                    _HeartbeatService.SlowTick += HeartbeatService_SlowTick;
                }
            }
        }
Esempio n. 21
0
    //TODO: Handle Resume:
    ///<summary>
    ///See <a href="https://discordapp.com/developers/docs/topics/voice-connections#resuming-voice-connection">Discord API Documentation</a>
    ///</summary>
    ///

    private void OnHello(HelloEventData e)
    {
        var payload = new GatewayPayload
        {
            OpCode = GatewayOpCode.Voice_Identify,
            Data   = new VoiceIdentifyRequest
            {
                server_id  = guildId,
                user_id    = userId,
                session_id = sessionId,
                token      = token
            }
        };

        voiceGateway.Send(payload);
        heartbeatService = new VoiceHeartbeatService(voiceGateway, e.heartbeat_interval);
    }
Esempio n. 22
0
 public SubmitHandInViewModel(ILastSaveViewModel lastSaveViewModel, IExamTimeLeftViewModel examTimeLeftViewModel, ILanguageService languageService, IHandInFieldValueStorageService handInFieldValueStorageService, IHandInFileSelectorViewModel handInFileSelectorViewModel, IMessenger messenger, IHandInFileService handInFileService, IBoardingPassStorageService boardingPassStorageService, IHandInFieldIdStorageService handInFieldIdStorageService, IHeartbeatService heartbeatService)
 {
     this._languageService = languageService;
     this._handInFieldValueStorageService = handInFieldValueStorageService;
     this._messenger                   = messenger;
     this._handInFileService           = handInFileService;
     this._boardingPassStorageService  = boardingPassStorageService;
     this._handInFieldIdStorageService = handInFieldIdStorageService;
     this._heartbeatService            = heartbeatService;
     this.LastSaveViewModel            = lastSaveViewModel;
     this.ExamTimeLeftViewModel        = examTimeLeftViewModel;
     this.HandInFileSelectorViewModel  = handInFileSelectorViewModel;
     this._messenger.Register <OnInitiateSubmitHandIn>((object)this, new Action <OnInitiateSubmitHandIn>(this.OnInitiateSubmitHandIn));
     this.PreviousViewCommand = (ICommand) new RelayCommand((Action <object>)(c => this.PreviousViewClick()), (Predicate <object>)null);
     this.NextViewCommand     = (ICommand) new RelayCommand((Action <object>)(c => this.NextViewClick()), (Predicate <object>)null);
     this._messenger.Register <OnHandInFieldsLoaded>((object)this, new Action <OnHandInFieldsLoaded>(this.OnHandInFieldsLoaded));
     this._messenger.Register <OnHandInFieldInputLostFocus>((object)this, new Action <OnHandInFieldInputLostFocus>(this.OnHandInFieldInputLostFocus));
 }
Esempio n. 23
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="parameters"></param>
        public void Startup(PluginStartupParameters parameters)
        {
            Singleton = this;

            lock (_SyncLock) {
                var optionsStorage = new OptionsStorage();
                _Options = optionsStorage.Load();

                _Database = Factory.Singleton.Resolve <IAutoConfigBaseStationDatabase>().Singleton.Database;
                _Database.FileNameChanging += BaseStationDatabase_FileNameChanging;
                _Database.FileNameChanged  += BaseStationDatabase_FileNameChanged;

                _StandingDataManager = Factory.Singleton.Resolve <IStandingDataManager>().Singleton;
                _StandingDataManager.LoadCompleted += StandingDataManager_LoadCompleted;

                var feedManager = Factory.Singleton.Resolve <IFeedManager>().Singleton;
                feedManager.FeedsChanged += FeedManager_FeedsChanged;

                _OnlineLookupCache          = Provider.CreateOnlineLookupCache();
                _OnlineLookupCache.Database = _Database;
                _OnlineLookupCache.RefreshOutOfDateAircraft = _Options.RefreshOutOfDateAircraft;
                _OnlineLookupCache.EnabledChanged          += OnlineLookupCache_EnabledChanged;
                StartSession();

                var onlineLookupManager = Factory.Singleton.Resolve <IAircraftOnlineLookupManager>().Singleton;
                onlineLookupManager.RegisterCache(_OnlineLookupCache, 100, letManagerControlLifetime: false);

                // If we process messages on the same thread as the listener raises the message received event on then we
                // will be running on the same thread as the aircraft list. Our processing can take some time, particularly if many
                // database writes have to happen simultaneously on startup, so to avoid blocking the update of the aircraft list
                // we create a background thread and process the messages on that.
                _BackgroundThreadMessageQueue = new BackgroundThreadQueue <BaseStationMessageEventArgs>("BaseStationDatabaseWriterMessageQueue", 200000);
                _BackgroundThreadMessageQueue.StartBackgroundThread(MessageQueue_MessageReceived, MessageQueue_ExceptionCaught);

                HookFeed();

                _HeartbeatService           = Factory.Singleton.Resolve <IHeartbeatService>();
                _HeartbeatService.SlowTick += Heartbeat_SlowTick;
                _HeartbeatService.Start();
            }
        }
Esempio n. 24
0
        public void Dispose()
        {
            foreach (var disposable in _handlers)
            {
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            _handlers.Clear();

            if (_heartbeatService != null)
            {
                _heartbeatService.Stop();
                _heartbeatService.Dispose();
                _heartbeatService = null;
            }

            _bus = null;
            _eventProcessingBus = null;
        }
Esempio n. 25
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        public void Start()
        {
            if (!_Started)
            {
                _Started   = true;
                _Clock     = Factory.Singleton.Resolve <IClock>();
                Downloader = Factory.Singleton.Resolve <IAirPressureDownloader>();
                Lookup     = Factory.Singleton.Resolve <IAirPressureLookup>();

                _SharedConfiguration = Factory.Singleton.ResolveSingleton <ISharedConfiguration>();
                Enabled = _SharedConfiguration.Get().BaseStationSettings.DownloadGlobalAirPressureReadings;
                _SharedConfiguration.ConfigurationChanged += SharedConfiguration_ConfigurationChanged;

                if (_BackgroundWorker == null)
                {
                    _BackgroundWorker         = Factory.Singleton.Resolve <IBackgroundWorker>();
                    _BackgroundWorker.DoWork += BackgroundWorker_DoWork;
                }

                _HeartbeatService           = Factory.Singleton.ResolveSingleton <IHeartbeatService>();
                _HeartbeatService.SlowTick += HeartbeatService_SlowTick;
            }
        }
Esempio n. 26
0
 public LoginViewModel(IMessenger messenger, IBoardingPassValidator boardingPassValidator, ILanguageService languageService, IConfigurationService configurationService, ITimerService loginAttemptsTimer, IBoardingPassStorageService boardingPassStorageService, IFlexClient flexClient, IHeartbeatService heartbeatService, IStorageCleanerService storageCleanerService)
 {
     this._messenger                  = messenger;
     this._boardingPassValidator      = boardingPassValidator;
     this._languageService            = languageService;
     this._configurationService       = configurationService;
     this._loginAttemptsTimer         = loginAttemptsTimer;
     this._boardingPassStorageService = boardingPassStorageService;
     this._flexClient                 = flexClient;
     this._heartbeatService           = heartbeatService;
     this._storageCleanerService      = storageCleanerService;
     this._messenger.Register <OnSuccessfulHealthCheck>((object)this, new Action <OnSuccessfulHealthCheck>(this.OnSuccessfulHealthCheck));
     this.UpdateText((OnLanguageChanged)null);
     this._messenger.Register <OnLanguageChanged>((object)this, new Action <OnLanguageChanged>(this.UpdateText));
     this._messenger.Register <OnLoginErrorPopupClosed>((object)this, new Action <OnLoginErrorPopupClosed>(this.OnLoginErrorPopupClosed));
     this.LoginCommand = (ICommand) new RelayCommand((Action <object>)(c => this.LoginClick()), (Predicate <object>)null);
     this._loginAttemptsTimer.AutoReset = false;
     this._loginAttemptsTimer.Interval  = (double)(configurationService.BoardingPassLoginLockDurationInSeconds * 1000);
     this._loginAttemptsTimer.Elapsed  += (ElapsedEventHandler)((s, e) =>
     {
         DispatcherHelper.CheckBeginInvokeOnUI((Action)(() => this.CanLogin = true));
         this.LoginAttemptsCounter = 0;
     });
 }
Esempio n. 27
0
 private void OnHello(HelloEventData e)
 {
     heartbeatService = new HeartbeatService(gateway, e.heartbeat_interval);
     heartbeatService.Start();
 }
Esempio n. 28
0
 public HeartbeatJob(IHeartbeatService heartbeat)
 {
     _heartbeat = heartbeat ?? throw new ArgumentNullException(nameof(heartbeat));
 }
 public HeartbeatController(
     IHeartbeatService heartbeatService
     )
 {
     _heartbeatService = heartbeatService;
 }
Esempio n. 30
0
 public HeartbeatHttp(IHeartbeatService heartbeatService)
 {
     this.heartbeatService = heartbeatService;
 }
        /// <summary>
        /// Creates a new object.
        /// </summary>
        public RawMessageTranslator()
        {
            Provider = new DefaultProvider();

            _StandingDataManager = Factory.Singleton.Resolve<IStandingDataManager>().Singleton;
            _Statistics = Factory.Singleton.Resolve<IStatistics>().Singleton;

            GlobalDecodeAirborneThresholdMilliseconds = 10000;
            GlobalDecodeFastSurfaceThresholdMilliseconds = 25000;
            GlobalDecodeSlowSurfaceThresholdMilliseconds = 50000;
            LocalDecodeMaxSpeedAirborne = 15.0;
            LocalDecodeMaxSpeedTransition = 5.0;
            LocalDecodeMaxSpeedSurface = 3.0;
            ReceiverRangeKilometres = 650;
            TrackingTimeoutSeconds = 600;
            AcceptIcaoInPI0Count = 1;
            AcceptIcaoInPI0Milliseconds = 1000;

            _CompactPositionReporting = Factory.Singleton.Resolve<ICompactPositionReporting>();

            _HeartbeatService = Factory.Singleton.Resolve<IHeartbeatService>().Singleton;
            _HeartbeatService.SlowTick += Heartbeat_SlowTick;
        }
 /// <summary>
 /// Disposes of or finalises the object.
 /// </summary>
 /// <param name="disposing"></param>
 private void Dispose(bool disposing)
 {
     if(disposing) {
         _Disposed = true;
         if(_HeartbeatService != null) {
             _HeartbeatService.SlowTick -= Heartbeat_SlowTick;
             _HeartbeatService = null;
         }
     }
 }
 public HeartbeatJob(IHeartbeatService hearbeat)
 {
     if (hearbeat == null) throw new ArgumentNullException("hearbeat");
     _hearbeat = hearbeat;
 }