예제 #1
0
        public virtual void OnMessage(QuickFix.FIX44.ApplicationMessageRequest message, SessionID session)
        {
            try
            {
                string sessionID = session.ToString();
                string applReqID = message.ApplReqID.ToString();
                logger.InfoFormat("SessionID[{0}]: ApplicationMessageRequest ApplReqID[{1}]", sessionID, applReqID);

                // Acrescenta o sessionID do cliente para controle
                applReqID = applReqID + "|" + sessionID;
                message.Set(new QuickFix.Fields.ApplReqID(applReqID));

                string[] quebraApplReqID = applReqID.Split("-".ToCharArray());
                string   channelID       = quebraApplReqID[1];

                logger.DebugFormat("SessionID[{0}]: ApplicationMessageRequest enviando para ChannelID[{1}] msg[{2}]",
                                   sessionID, channelID, message.ToString());
                bool bRet = Session.SendToTarget(message, _dctSessionsFixChannels[channelID]);
                if (!bRet)
                {
                    logger.ErrorFormat("SessionID[{0}]: Falha ApplicationMessageRequest msg[{1}]", sessionID, message.ToString());
                }
            }
            catch (Exception ex)
            {
                logger.Error("onMessage(ApplicationMessageRequest): " + ex.Message, ex);
            }
        }
예제 #2
0
        public virtual void SendMessageRequest(int applBegSeqNum, int applEndSeqNum)
        {
            QuickFix.FIX44.ApplicationMessageRequest request = new QuickFix.FIX44.ApplicationMessageRequest();
            try
            {
                //_mktIncProc.HabilitarProcessamentoMensagens = false;

                StringBuilder applReqID = new StringBuilder();
                applReqID.Append(DateTime.Now.ToString("yyyyMMddHHmmss"));
                applReqID.Append("-");
                applReqID.Append(_channelUmdfConfig.ChannelID);
                applReqID.Append("-");
                applReqID.Append(applBegSeqNum.ToString());
                applReqID.Append("-");
                applReqID.Append(applEndSeqNum.ToString());

                logger.Info("Solicitando replay. ApplReqID[" + applReqID.ToString() + "]");

                request.Set(new QuickFix.Fields.ApplReqID(applReqID.ToString()));
                request.Set(new QuickFix.Fields.ApplReqType(0));

                QuickFix.FIX44.ApplicationMessageRequest.NoApplIDsGroup groupApplIDs = new QuickFix.FIX44.ApplicationMessageRequest.NoApplIDsGroup();
                groupApplIDs.Set(new QuickFix.Fields.RefApplID(_channelUmdfConfig.ChannelID));
                groupApplIDs.Set(new QuickFix.Fields.ApplBegSeqNum(applBegSeqNum));
                groupApplIDs.Set(new QuickFix.Fields.ApplEndSeqNum(applEndSeqNum));

                request.AddGroup(groupApplIDs);

                bool bRet = Session.SendToTarget(request, _session);
                if (!bRet)
                {
                    logger.Error("Falha na solicitacao do replay. ApplReqID[" + applReqID.ToString() + "]");
                }
            }
            catch (Exception ex)
            {
                logger.Error("SendMessageRequest(): " + ex.Message, ex);
            }
        }