示例#1
0
        public virtual void OnMessage(QuickFix.FIX44.ApplicationMessageReport message, SessionID session)
        {
            try
            {
                string[] quebraApplReqID   = message.ApplReqID.ToString().Split("|".ToCharArray());
                string   applReqID         = quebraApplReqID[0];
                string   sessionIDResponse = quebraApplReqID[1];

                // Retorna o applReqID original
                message.Set(new QuickFix.Fields.ApplReqID(quebraApplReqID[0]));

                // Inverte origem e destino da mensagem, para devolver a resposta ao cliente Fix
                message.Header.SetField(new QuickFix.Fields.SenderCompID(_dctSessionsFixClients[sessionIDResponse].TargetCompID));
                message.Header.SetField(new QuickFix.Fields.SenderSubID(_dctSessionsFixClients[sessionIDResponse].TargetSubID));
                message.Header.SetField(new QuickFix.Fields.TargetCompID(_dctSessionsFixClients[sessionIDResponse].SenderCompID));
                message.Header.SetField(new QuickFix.Fields.TargetSubID(_dctSessionsFixClients[sessionIDResponse].SenderSubID));

                logger.InfoFormat("SessionID[{0}]: ApplicationMessageReport enviando para sessionIDResponse[{1}] msg[{2}]",
                                  session.ToString(), sessionIDResponse, message.ToString());
                bool bRet = Session.SendToTarget(message, _dctSessionsFixClients[sessionIDResponse]);
                if (!bRet)
                {
                    logger.ErrorFormat("SessionID[{0}]: Falha ApplicationMessageReport sessionIDResponse[{1}] msg[{2}]",
                                       session.ToString(), sessionIDResponse, message.ToString());
                }
            }
            catch (Exception ex)
            {
                logger.Error("onMessage(ApplicationMessageReport): " + ex.Message, ex);
            }
        }
示例#2
0
 public virtual void OnMessage(QuickFix.FIX44.ApplicationMessageReport message, SessionID session)
 {
     try
     {
         logger.DebugFormat("ApplicationMessageReport ApplReqID[{0}] msg[{1}]", message.ApplReqID.ToString(), message.ToString());
     }
     catch (Exception ex)
     {
         logger.Error("onMessage(ApplicationMessageReport): " + ex.Message, ex);
     }
 }
示例#3
0
        public virtual void OnMessage(QuickFix.FIX44.ApplicationMessageReport message, SessionID session)
        {
            try
            {
                logger.Info("*** Relatorio de Retransmissao");
                logger.Info("ApplReportID.....: " + message.GetString(QuickFix.Fields.Tags.ApplReportID));
                logger.Info("ApplReportType...: " + message.GetString(QuickFix.Fields.Tags.ApplReportType));

                int applReportType = Convert.ToInt32(message.ApplReportType.ToString());

                string lastSeqNum = "";
                if (message.IsSetField(QuickFix.Fields.Tags.NoApplIDs))
                {
                    int numApplIDs = message.GetInt(QuickFix.Fields.Tags.NoApplIDs);
                    logger.Info("ApplIDs..........: " + numApplIDs);
                    for (int numApplID = 1; numApplID <= numApplIDs; numApplID++)
                    {
                        QuickFix.FIX44.ApplicationMessageReport.NoApplIDsGroup groupApplID = new QuickFix.FIX44.ApplicationMessageReport.NoApplIDsGroup();
                        message.GetGroup(numApplID, groupApplID);

                        logger.Info("RefApplID[" + numApplID + "].....:" + groupApplID.GetString(QuickFix.Fields.Tags.RefApplID));
                        if (groupApplID.IsSetField(QuickFix.Fields.Tags.RefApplLastSeqNum))
                        {
                            lastSeqNum = groupApplID.GetString(QuickFix.Fields.Tags.RefApplLastSeqNum);
                            logger.Info("RefApplLastSeqNum[" + numApplID + "].:" + lastSeqNum);
                        }

                        if (groupApplID.IsSetField(QuickFix.Fields.Tags.ApplRespError))
                        {
                            logger.Info("ApplResponseError[" + numApplID + "].:" + groupApplID.GetString(QuickFix.Fields.Tags.ApplRespError));
                        }
                    }
                }
                string[] quebraApplReqID = message.GetString(QuickFix.Fields.Tags.ApplReqID).Split("-".ToCharArray());
                string   channelID       = quebraApplReqID[1];

                if (applReportType == 3)
                {
                    logger.Info("Libera ChannelID: [" + channelID + "]");
                    lock (listaChannelQueues[channelID].replayLockObject)
                    {
                        Monitor.Pulse(listaChannelQueues[channelID].replayLockObject);
                    }
                }
                else
                {
                    logger.Warn("Application Resend Error, nao libera channelID [" + channelID + "] devera reiniciar por timeout");

                    if (DateTime.Now.DayOfWeek != DayOfWeek.Sunday && DateTime.Now.DayOfWeek != DayOfWeek.Saturday)
                    {
                        if (DateTime.Now.Hour >= ConstantesMDS.HORARIO_NOTIFICACAO_EMAIL_INICIO &&
                            DateTime.Now.Hour < ConstantesMDS.HORARIO_NOTIFICACAO_EMAIL_FIM)
                        {
                            MDSUtils.EnviarEmail("Erro em recovery [" + channelID + "]", "Application Resend Error, nao libera channelID [" + channelID + "] devera reiniciar por timeout");
                        }
                    }
                }

                logger.Info("Final da Retransmissao ***");
            }
            catch (Exception ex)
            {
                logger.Error("onMessage(ApplicationMessageReport): " + ex.Message, ex);
            }
        }