private void despacharEventos(object sender, AnaliseGraficaNegocioEventArgs args)
        {
            try
            {
                string mensagem = null;

                EventoNegocioANG eventoANG = args.Evento;

                mensagem = eventoANG.mensagem;

                if (!String.IsNullOrEmpty(mensagem))
                {
                    bool sinaliza = queueToAnaliseGrafica.IsEmpty;
                    queueToAnaliseGrafica.Enqueue(mensagem);
                    if (sinaliza)
                    {
                        lock (syncQueueToAnaliseGrafica)
                        {
                            Monitor.Pulse(syncQueueToAnaliseGrafica);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("despacharEventos(): " + ex.Message, ex);
            }
        }
示例#2
0
        /// <summary>
        ///
        ///
        /// </summary>
        private void procANGQueueNegocio()
        {
            long lstEvent = 0;

            logger.Info("Inicializando thread do processamento da fila de eventos de Negocios ANG");

            while (bKeepRunning)
            {
                try
                {
                    EventoNegocioANG e;
                    if (queueANG.TryDequeue(out e))
                    {
                        if (OnEventoNegocioAnaliseGrafica != null)
                        {
                            AnaliseGraficaNegocioEventArgs args = new AnaliseGraficaNegocioEventArgs();
                            args.Evento = e;
                            OnEventoNegocioAnaliseGrafica(this, args);
                        }

                        if (MDSUtils.shouldLog(lstEvent))
                        {
                            lstEvent = DateTime.UtcNow.Ticks;
                            logger.Info("Fila queueANG: " + queueANG.Count + " eventos.");
                        }

                        continue;
                    }

                    lock (syncQueueANG)
                    {
                        Monitor.Wait(syncQueueANG, QUEUE_WAIT_TIMEOUT);
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("procANGQueueNegocio: " + ex.Message, ex);
                }
            }
        }