Esempio n. 1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            var _kerner = new StandardKernel(new MappingNinject());

            for (int i = 0; i < 1; i++)
            {
                var workerTask = new Task(() =>
                {
                    IHandlerClick handler = _kerner.Get <IHandlerClick>();
                    ConsumerBasic <MsProduct> consumer = new ConsumerBasic <MsProduct>(RabbitMQManager.GetRabbitMQServer("rabbitMQ177_OnClick"), "Product.OnClick");
                    consumer._eventProcessJob         += (job) =>
                    {
                        handler.Process(job);
                    };

                    consumer.StartConsume();
                });
                workerTask.Start();
            }
            Console.ReadLine();

            //var servicesToRun = new ServiceBase[]
            //{
            //    new ReportErrorProductOnClick()
            //};
            //ServiceBase.Run(servicesToRun);
        }
Esempio n. 2
0
        public void RunTest()
        {
            IKernel kerner = new StandardKernel(new MappingNinject());

            var settingRepository = kerner.Get <ISettingRepository>();
            var handler           = kerner.Get <IHandlerClick>();
            ConsumerBasic <MsProduct> consumer = new ConsumerBasic <MsProduct>(RabbitMQManager.GetRabbitMQServer("rabbitMQ177_OnClick"), settingRepository.QueueProductClick);

            consumer._eventProcessJob += (job) =>
            {
                handler.Process(job);
            };
            consumer.StartConsume();
        }
Esempio n. 3
0
 protected override void OnStart(string[] args)
 {
     for (int i = 0; i < _workerCount; i++)
     {
         var workerTask = new Task(() =>
         {
             IHandlerClick handler = _kerner.Get <IHandlerClick>();
             ConsumerBasic <MsProduct> consumer = new ConsumerBasic <MsProduct>(RabbitMQManager.GetRabbitMQServer("rabbitMQ177_OnClick"), _settingRepository.QueueProductClick);
             consumer._eventProcessJob         += (job) =>
             {
                 handler.Process(job);
             };
             lstConsumerBasics.Add(consumer);
             consumer.StartConsume();
         });
         workerTask.Start();
         _log.InfoFormat("Worker {0} started", i);
     }
 }