Ejemplo 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);
            }
        }
Ejemplo 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);
     }
 }
Ejemplo 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);
                }
            }
        }
Ejemplo 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);
                }
            }
        }