QuickFix.Message.GetReverseSessionID C# (CSharp) Method

GetReverseSessionID() public static method

public static GetReverseSessionID ( Message msg ) : SessionID
msg Message
return SessionID
        public static SessionID GetReverseSessionID(Message msg)
        {
            return new SessionID(
                GetFieldOrDefault(msg.Header, Tags.BeginString, null),
                GetFieldOrDefault(msg.Header, Tags.TargetCompID, null),
                GetFieldOrDefault(msg.Header, Tags.SenderCompID, null)
            );
        }

Same methods

Message::GetReverseSessionID ( string msg ) : SessionID

Usage Example

コード例 #1
0
ファイル: SocketReader.cs プロジェクト: RJOBrien/quickfixn
        protected void OnMessageFoundInternal(string msg)
        {
            // Message fixMessage;

            try
            {
                if (null == qfSession_)
                {
                    Message adjustedMsg = null;

                    if (socketSettings_.RjoAdapterTestMode)
                    {
                        this.Log("RjoAdapterTestMode: ignoring SenderSubID & SenderLocID in sender's logon message");
                        // need to ignore client's SubID when looking up session
                        Regex  rgx = new Regex($"{Message.SOH}50=[^{Message.SOH}]*");
                        string s   = rgx.Replace(msg, "");
                        rgx         = new Regex($"{Message.SOH}142=[^{Message.SOH}]*");
                        s           = rgx.Replace(s, "");
                        adjustedMsg = new Message(s, false);
                    }
                    else
                    {
                        adjustedMsg = new Message(msg);
                    }

                    qfSession_ = Session.LookupSession(Message.GetReverseSessionID(adjustedMsg));
                    if (null == qfSession_)
                    {
                        this.Log("ERROR: Disconnecting; received message for unknown session: " + adjustedMsg);
                        DisconnectClient();
                        return;
                    }
                    else
                    {
                        if (!HandleNewSession(msg))
                        {
                            return;
                        }
                    }
                }

                try
                {
                    qfSession_.Next(msg);
                }
                catch (System.Exception e)
                {
                    this.Log("Error on Session '" + qfSession_.SessionID + "': " + e.ToString());
                }
            }
            catch (InvalidMessage e)
            {
                HandleBadMessage(msg, e);
            }
            catch (MessageParseError e)
            {
                HandleBadMessage(msg, e);
            }
        }
All Usage Examples Of QuickFix.Message::GetReverseSessionID