public bool Send(string msgStr) { QuickFix.Fields.MsgType msgType = QuickFix.Message.IdentifyType(msgStr); string beginString = QuickFix.Message.ExtractBeginString(msgStr); QuickFix.Message message = messageFactory.Create(beginString, msgType.Obj); QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary(); message.FromString(msgStr, false, dd, dd, _defaultMsgFactory); if (!msgLookup.ContainsKey(msgType.getValue())) { msgLookup.Add(msgType.getValue(), new Queue <QuickFix.Message>()); } msgLookup[msgType.getValue()].Enqueue(message); QuickFix.Fields.PossDupFlag possDup = new QuickFix.Fields.PossDupFlag(false); if (message.Header.IsSetField(possDup)) { message.Header.GetField(possDup); } if (possDup.getValue() && msgType.getValue() != QuickFix.Fields.MsgType.SEQUENCE_RESET) { dups.Enqueue(message); } return(true); }
internal MessageBuilder( string msgStr, bool validateLengthAndChecksum, DataDictionary.DataDictionary sessionDD, DataDictionary.DataDictionary appDD, IMessageFactory msgFactory) { _msgStr = msgStr; _validateLengthAndChecksum = validateLengthAndChecksum; _sessionDD = sessionDD; _appDD = appDD; _msgFactory = msgFactory; _msgType = Message.IdentifyType(_msgStr); _beginString = Message.ExtractBeginString(_msgStr); }
internal MessageBuilder( string msgStr, bool validateLengthAndChecksum, DataDictionary.DataDictionary sessionDD, DataDictionary.DataDictionary appDD, IMessageFactory msgFactory) { _msgStr = msgStr; _validateLengthAndChecksum = validateLengthAndChecksum; _sessionDD = sessionDD; _appDD = appDD; _msgFactory = msgFactory; _msgType = Message.IdentifyType(_msgStr); _beginString = Message.ExtractBeginString(_msgStr); }
public void ValidateWithRepeatingGroupTest() { QuickFix.DataDictionary.DataDictionary dd = new QuickFix.DataDictionary.DataDictionary("../../../spec/fix/FIX42.xml"); QuickFix.FIX42.MessageFactory f = new QuickFix.FIX42.MessageFactory(); string nul = Message.SOH; string msgStr = "8=FIX.4.2" + nul + "9=87" + nul + "35=B" + nul + "34=3" + nul + "49=CLIENT1" + nul + "52=20111012-22:15:55.474" + nul + "56=EXECUTOR" + nul + "148=AAAAAAA" + nul + "33=2" + nul + "58=L1" + nul + "58=L2" + nul + "10=016" + nul; QuickFix.Fields.MsgType msgType = Message.IdentifyType(msgStr); string beginString = Message.ExtractBeginString(msgStr); Message message = f.Create(beginString, msgType.Obj); message.FromString(msgStr, true, dd, dd, f); dd.Validate(message, beginString, msgType.Obj); }
public virtual void ToApp(QuickFix.Message message, QuickFix.SessionID sessionID) { try { QuickFix.Fields.MsgType msgType = new QuickFix.Fields.MsgType(); string msg = message.Header.GetField(msgType).getValue(); updateDisplay(string.Format("Message Sent: toApp {0}" , msg )); } catch (Exception ex) { updateDisplay("QuickFIX Error"); log.WriteLog(ex.ToString()); } }
public virtual void ToAdmin(QuickFix.Message message, QuickFix.SessionID sessionID) { try { QuickFix.Fields.MsgType mt = new QuickFix.Fields.MsgType(); message.Header.GetField(mt); if (mt.getValue() == QuickFix.Fields.MsgType.LOGON ) { if (!String.IsNullOrEmpty(_password)) { message.SetField(new QuickFix.Fields.RawData(_password)); } if (_resetSession) { message.SetField(new QuickFix.Fields.ResetSeqNumFlag(true)); } } } catch (Exception ex) { updateDisplay("QuickFIX Error"); log.WriteLog(ex.ToString()); } }
public virtual void FromApp(QuickFix.Message message, QuickFix.SessionID session) { try { QuickFix.Fields.MsgType msgType = new QuickFix.Fields.MsgType(); message.Header.GetField(msgType); string msgTypeValue = msgType.getValue(); updateDisplay(string.Format("fromApp: {0}", msgTypeValue)); //switch (msgTypeValue) //{ // case "UAT": // onGatewayStatusMessage((QuickFix.FIX42.Message)message, session); // break; // case "UAP": // onPositionReportMessage((QuickFix.FIX42.Message)message, session); // break; // default: Crack(message, session); // break; //} } catch (QuickFix.UnsupportedMessageType umt) { updateDisplay("UnsupportedMessageType: " + umt.Message); ProcessMessage(message, session); } catch (Exception ex) { updateDisplay("QuickFIX Error"); log.WriteLog("Source: " + ex.Source); log.WriteLog("Message: " + ex.Message); log.WriteLog("TargetSite: " + ex.TargetSite); log.WriteLog("InnerException: " + ex.InnerException); log.WriteLog("HelpLink: " + ex.HelpLink); log.WriteLog("Data: " + ex.Data); log.WriteLog("StackTrace: " + ex.StackTrace); } }