Exemplo n.º 1
0
        private void TodayQueuePlan_CurrentClientRequestPlanUpdated(object sender, QueuePlanEventArgs e)
        {
            if (OnCurrentClientRequestPlanUpdated != null)
            {
                var eventArgs = new QueueInstanceEventArgs()
                {
                    Operator = Mapper.Map<Operator, DTO.Operator>(e.Operator)
                };

                if (e.ClientRequestPlan != null)
                {
                    logger.Debug("Текущий план запроса клиента у оператора [{0}] [{1}]", e.Operator, e.ClientRequestPlan);
                    eventArgs.ClientRequestPlan = Mapper.Map<ClientRequestPlan, DTO.ClientRequestPlan>(e.ClientRequestPlan);
                }
                else
                {
                    logger.Debug("У оператора [{0}] отсутствуют текущие запросы", e.Operator);
                }

                logger.Debug("Запуск обработчика для события [CurrentClientRequestPlanUpdated] с кол-вом слушателей [{0}]",
                    OnCurrentClientRequestPlanUpdated.GetInvocationList().Length);
                OnCurrentClientRequestPlanUpdated(this, eventArgs);
            }
        }
Exemplo n.º 2
0
 private void queueInstance_OnEvent(object sender, QueueInstanceEventArgs e)
 {
     try
     {
         Task.Run(() => eventsCallback.Event(e.Event));
     }
     catch (ObjectDisposedException exception)
     {
         logger.Debug(exception);
     }
     catch (Exception exception)
     {
         logger.Error(exception);
         UnSubscribe(QueuePlanEventType.Event);
     }
 }
Exemplo n.º 3
0
        private void queueInstance_OnOperatorPlanMetricsUpdated(object sender, QueueInstanceEventArgs e)
        {
            var subscription = subscriptions[QueuePlanEventType.OperatorPlanMetricsUpdated];
            var args = subscription.Args;

            logger.Debug("OnOperatorPlanMetricsUpdated = {0}", args.Operators);

            if (args == null || args.Operators != null && args.Operators.Any(o => o.Equals(e.OperatorPlanMetrics.Operator)))
            {
                try
                {
                    Task.Run(() => eventsCallback.OperatorPlanMetricsUpdated(e.OperatorPlanMetrics));
                }
                catch (ObjectDisposedException exception)
                {
                    logger.Debug(exception);
                }
                catch (Exception exception)
                {
                    logger.Error(exception);
                    UnSubscribe(QueuePlanEventType.OperatorPlanMetricsUpdated);
                }
            }
        }
Exemplo n.º 4
0
        private void queueInstance_OnConfigUpdated(object sender, QueueInstanceEventArgs e)
        {
            var subscription = subscriptions[QueuePlanEventType.ConfigUpdated];
            var args = subscription.Args;

            if (args == null || args.ConfigTypes.Length > 0
                && args.ConfigTypes.Contains(e.Config.Type))
            {
                try
                {
                    Task.Run(() => eventsCallback.ConfigUpdated(e.Config));
                }
                catch (ObjectDisposedException exception)
                {
                    logger.Debug(exception);
                }
                catch (Exception exception)
                {
                    logger.Error(exception);
                    UnSubscribe(QueuePlanEventType.ConfigUpdated);
                }
            }
        }