Example #1
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();
        }
Example #2
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();
 }
Example #3
0
 private void OnReady(VoiceReadyResponse e)
 {
     //Start heartbeat
     heartbeatService.Start();
     //Initialize UDP
     udpClient = new VoiceUdpClient(e.ip, e.port, e.ssrc);
     udpClient.Start();
 }
Example #4
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();
            }
        }
Example #5
0
 private void OnHello(HelloEventData e)
 {
     heartbeatService = new HeartbeatService(gateway, e.heartbeat_interval);
     heartbeatService.Start();
 }