示例#1
0
        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.Configure();

            //GlobalConfiguration.Configuration.DependencyResolver = new NinjectResolver();
            SetupDatabase();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            try
            {
                //TODO per DI das zeug reinladen
                var gateCampDetector = new GateCampDetector(new SqliteStargateLocationRepository());
                GateCampsWebSocketHandler.GateCampDetector = gateCampDetector;

                var gcd = new GateCampDetectionService(
                    gateCampDetector,
                    new GateCampDifferenceDetector());

                Task.Factory.StartNew(gcd.Start, TaskCreationOptions.LongRunning);
                Task.Factory.StartNew(() => { ZKillboardRedisqClient.Start(gcd); }, TaskCreationOptions.LongRunning);
            }
            catch (Exception e)
            {
                LOG.Error("error", e);
            }
            //Task.Factory.StartNew(ZKillboardStompFeedConsumer.Start, TaskCreationOptions.LongRunning);
            LOG.Info("Application started successfully");
        }
示例#2
0
        //private static readonly BlockingCollection<Kill> KILLS = new BlockingCollection<Kill>();
        public static void Start(GateCampDetectionService gateCampDetectionService)
        {
            while (true)
            {
                try
                {
                    var kill = ReadKillFromRedisq();
                    if (kill == null)
                    {
                        continue;
                    }
                    KillEntryWriter.Instance.ForceAdd(
                        new KillEntries
                    {
                        CharacterId = -1,
                        Kills       = new List <Kill>
                        {
                            kill
                        }
                    });

                    gateCampDetectionService.AddKill(kill);
                }
                catch (Exception e)
                {
                    LOG.Warn("Error in redisq connection: " + e.Message, e);
                }
            }
        }