Exemple #1
0
        private void _processMessage(TODropCopy to)
        {
            try
            {
                // Buscar quais sessoes postar a mensagem
                List <SessionDropCopy> lst = null;

                if (_dicSessionsDropCopy.TryGetValue(to.Canal, out lst))
                {
                    for (int i = 0; i < lst.Count; i++)
                    {
                        if (lst[i].Conectado)
                        {
                            // QuickFix.Message qf = new QuickFix.Message(to.MensagemQF);
                            lst[i].AddMessage(to.MensagemQF);
                            //qf.Clear();
                            //qf = null;
                        }
                    }
                    to = null;
                }
                // lst.Clear();
                lst = null;
            }
            catch (Exception ex)
            {
                logger.Error("Problemas no processamento da mensagem DropCopy: " + ex.Message, ex);
            }
        }
Exemple #2
0
 public void Send2DropCopy(QuickFix.Message msg)
 {
     try
     {
         if (null != this.DropCopy)
         {
             TODropCopy toDC = new TODropCopy();
             toDC.Canal      = this.Config.Operador;
             toDC.MensagemQF = new QuickFix.Message(msg);
             this.DropCopy.AddMessage(toDC);
             toDC = null;
         }
     }
     catch (Exception ex)
     {
         logger.Error("Send2DropCopy() - Erro no envio para Sessao DropCopy: " + ex.Message, ex);
     }
 }
Exemple #3
0
        private void SendToDropCopy()
        {
            try
            {
                while (_running)
                {
                    TODropCopy msg = null;
#if _CQUEUE
                    if (!_queueDropCopy.TryDequeue(out msg))
                    {
                        lock (_queueDropCopy)
                        {
                            Monitor.Wait(_queueDropCopy, 50);
                        }
                    }
#else
                    lock (_queueDropCopy)
                    {
                        if (_queueDropCopy.Count > 0)
                        {
                            msg = _queueDropCopy.Dequeue();
                        }
                        else
                        {
                            Monitor.Wait(_queueDropCopy, 5);
                            continue;
                        }
                    }
#endif
                    if (null != msg)
                    {
                        this._processMessage(msg);
                        msg = null;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("SendToExchange(): " + ex.Message, ex);
            }
        }
Exemple #4
0
        public void AddMessage(TODropCopy to)
        {
            try
            {
#if _CQUEUE
                _queueDropCopy.Enqueue(to);
                lock (_queueDropCopy)
                {
                    Monitor.Pulse(_queueDropCopy);
                }
#else
                lock (_queueDropCopy)
                {
                    _queueDropCopy.Enqueue(to);
                    Monitor.Pulse(_queueDropCopy);
                }
#endif
            }
            catch (Exception ex)
            {
                logger.Error("AddMessage(): " + ex.Message, ex);
            }
        }