ResetSeqNumFlag Field
Inheritance: BooleanField
コード例 #1
0
        /// <summary>
        /// Add username and password before sending the message
        /// </summary>
        /// <param name="message"></param>
        /// <param name="sessionId"></param>
        private void OnMessage(QuickFix.FIX44.Logon message, SessionID sessionId)
        {
            try
            {
                // Username & Password
                QuickFix.Fields.Username        username        = new QuickFix.Fields.Username(this._userName);
                QuickFix.Fields.Password        password        = new QuickFix.Fields.Password(this._password);
                QuickFix.Fields.SenderCompID    senderCompId    = new QuickFix.Fields.SenderCompID(_tradeSenderCompId);
                QuickFix.Fields.TargetCompID    tragetCompId    = new QuickFix.Fields.TargetCompID(_tradeTargetCompId);
                QuickFix.Fields.TargetSubID     targerSubId     = new QuickFix.Fields.TargetSubID(_tradeTargetSubId);
                QuickFix.Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(true);

                // Set values in the message body before sending to integral gateway
                message.Username = username;
                message.Password = password;

                message.SetField(senderCompId);
                message.SetField(tragetCompId);
                message.SetField(targerSubId);

                message.ResetSeqNumFlag = resetSeqNumFlag;
            }
            catch (Exception exception)
            {
                Logger.Error(exception.ToString(), _type.FullName, "OnMessage");
            }
        }
コード例 #2
0
        /// <summary>
        /// Add username and password before sending the message
        /// </summary>
        /// <param name="message"></param>
        /// <param name="sessionId"></param>
        private void OnMessage(QuickFix.FIX42.Logon message, SessionID sessionId)
        {
            try
            {
                QuickFix.Fields.EncryptMethod   encryptMethod   = new QuickFix.Fields.EncryptMethod(0);
                QuickFix.Fields.HeartBtInt      heartBtInt      = new QuickFix.Fields.HeartBtInt(30);
                QuickFix.Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(true);

                message.SetField(encryptMethod);
                message.SetField(heartBtInt);
            }
            catch (Exception exception)
            {
                Logger.Error(exception.ToString(), _type.FullName, "OnMessage");
            }
        }
        /// <summary>
        /// Add username and password before sending the message
        /// </summary>
        /// <param name="message"></param>
        /// <param name="sessionId"></param>
        private void OnMessage(QuickFix.FIX44.Logon message, SessionID sessionId)
        {
            try
            {
                // Username & Password
                QuickFix.Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(true);
                QuickFix.Fields.EncryptMethod   encryptMethod   = new QuickFix.Fields.EncryptMethod(0);
                QuickFix.Fields.HeartBtInt      heartBtInt      = new QuickFix.Fields.HeartBtInt(GetHeartBeatInterval());

                // Set values in the message body before sending
                message.ResetSeqNumFlag = resetSeqNumFlag;
                message.EncryptMethod   = encryptMethod;
                message.HeartBtInt      = heartBtInt;
            }
            catch (Exception exception)
            {
                Logger.Error(exception.ToString(), _type.FullName, "OnMessage");
            }
        }
コード例 #4
0
        /// <summary>
        /// Add username and password before sending the message
        /// </summary>
        /// <param name="message"></param>
        /// <param name="sessionId"></param>
        private void OnMessage(QuickFix.FIX43.Logon message, SessionID sessionId)
        {
            try
            {
                // Username & Password
                QuickFix.Fields.Username        username        = new QuickFix.Fields.Username(this._userName);
                QuickFix.Fields.Password        password        = new QuickFix.Fields.Password(this._password);
                QuickFix.Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(true);

                // Set values in the message body before sending to GTX gateway
                message.Username        = username;
                message.Password        = password;
                message.ResetSeqNumFlag = resetSeqNumFlag;
            }
            catch (Exception exception)
            {
                Logger.Error(exception.ToString(), _type.FullName, "OnMessage");
            }
        }
コード例 #5
0
        protected bool SendRaw(Message message, int seqNum)
        {
            lock (sync_)
            {
                string msgType = message.Header.GetField(Fields.Tags.MsgType);

                InitializeHeader(message, seqNum);

                if (Message.IsAdminMsgType(msgType))
                {
                    /// FIXME this.Application.ToAdmin(message, this.SessionID);

                    if (MsgType.LOGON.Equals(msgType) && !state_.ReceivedReset)
                    {
                        Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(false);
                        if (message.IsSetField(resetSeqNumFlag))
                        {
                            message.GetField(resetSeqNumFlag);
                        }
                        if (resetSeqNumFlag.getValue())
                        {
                            state_.Reset();
                            message.Header.SetField(new Fields.MsgSeqNum(state_.GetNextSenderMsgSeqNum()));
                        }
                        state_.SentReset = resetSeqNumFlag.Obj;
                    }
                }

                string messageString = message.ToString();
                if (0 == seqNum)
                {
                    Persist(message, messageString);
                }
                return(Send(messageString));
            }
        }
コード例 #6
0
ファイル: Session.cs プロジェクト: thomasfleming/quickfixn
        protected bool SendRaw(Message message, int seqNum)
        {
            lock (sync_)
            {
                string msgType = message.Header.GetField(Fields.Tags.MsgType);

                InitializeHeader(message, seqNum);

                if (Message.IsAdminMsgType(msgType))
                {
                    this.Application.ToAdmin(message, this.SessionID);

                    if (MsgType.LOGON.Equals(msgType) && !state_.ReceivedReset)
                    {
                        Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(false);
                        if (message.IsSetField(resetSeqNumFlag))
                            message.GetField(resetSeqNumFlag);
                        if (resetSeqNumFlag.getValue())
                        {
                            state_.Reset();
                            message.Header.SetField(new Fields.MsgSeqNum(state_.GetNextSenderMsgSeqNum()));
                        }
                        state_.SentReset = resetSeqNumFlag.Obj;
                    }
                }
                else
                {
                    this.Application.ToApp(message, this.SessionID);
                }

                string messageString = message.ToString();
                if (0 == seqNum)
                    Persist(message, messageString);
                return Send(messageString);
            }
        }
コード例 #7
0
ファイル: Session.cs プロジェクト: thomasfleming/quickfixn
        protected void NextLogon(Message logon)
        {
            Fields.ResetSeqNumFlag resetSeqNumFlag = new Fields.ResetSeqNumFlag(false);
            if (logon.IsSetField(resetSeqNumFlag))
                logon.GetField(resetSeqNumFlag);
            state_.ReceivedReset = resetSeqNumFlag.Obj;

            if (!state_.IsInitiator && this.ResetOnLogon)
                state_.Reset();

            if (!Verify(logon, false, true))
                return;

            if (!IsGoodTime(logon))
            {
                this.Log.OnEvent("Logon had bad sending time");
                Disconnect("bad sending time");
                return;
            }

            state_.ReceivedLogon = true;
            this.Log.OnEvent("Received logon");
            if (!state_.IsInitiator)
            {
                int heartBtInt = logon.GetInt(Fields.Tags.HeartBtInt);
                state_.HeartBtInt = heartBtInt;
                GenerateLogon(logon);
                this.Log.OnEvent("Responding to logon request");
            }

            state_.SentReset = false;
            state_.ReceivedReset = false;

            int msgSeqNum = logon.Header.GetInt(Fields.Tags.MsgSeqNum);
            if (IsTargetTooHigh(msgSeqNum) && !resetSeqNumFlag.Obj)
            {
                DoTargetTooHigh(logon, msgSeqNum);
            }
            else
            {
                state_.IncrNextTargetMsgSeqNum();
                NextQueued();
            }

            if (this.IsLoggedOn)
                this.Application.OnLogon(this.SessionID);
        }
コード例 #8
0
ファイル: Logon.cs プロジェクト: RemiGaudin/quickfixn
 public void Set(QuickFix.Fields.ResetSeqNumFlag val) 
 { 
     this.ResetSeqNumFlag = val;
 }
コード例 #9
0
 public bool IsSet(QuickFix.Fields.ResetSeqNumFlag val)
 {
     return(IsSetResetSeqNumFlag());
 }
コード例 #10
0
 public QuickFix.Fields.ResetSeqNumFlag Get(QuickFix.Fields.ResetSeqNumFlag val)
 {
     GetField(val);
     return(val);
 }
コード例 #11
0
 public void Set(QuickFix.Fields.ResetSeqNumFlag val)
 {
     this.ResetSeqNumFlag = val;
 }
コード例 #12
0
ファイル: Session.cs プロジェクト: kevholditch/quickfixn
        protected void NextLogon(Message logon)
        {
            Fields.ResetSeqNumFlag resetSeqNumFlag = new Fields.ResetSeqNumFlag(false);
            if (logon.IsSetField(resetSeqNumFlag))
                logon.GetField(resetSeqNumFlag);
            state_.ReceivedReset = resetSeqNumFlag.Obj;

            if (state_.ReceivedReset)
            {
                this.Log.OnEvent("Sequence numbers reset due to ResetSeqNumFlag=Y");
                if (!state_.SentReset)
                {
                    state_.Reset("Reset requested by counterparty");
                }
            }

            if (!state_.IsInitiator && this.ResetOnLogon)
                state_.Reset("ResetOnLogon");
            if (this.RefreshOnLogon)
                Refresh();

            if (!Verify(logon, false, true))
                return;

            if (!IsGoodTime(logon))
            {
                this.Log.OnEvent("Logon has bad sending time");
                Disconnect("bad sending time");
                return;
            }

            state_.ReceivedLogon = true;
            this.Log.OnEvent("Received logon");
            if (!state_.IsInitiator)
            {
                int heartBtInt = logon.GetInt(Fields.Tags.HeartBtInt);
                state_.HeartBtInt = (int)Math.Floor(heartBtInt / (double)2);
                GenerateLogon(logon);
                this.Log.OnEvent("Responding to logon request");
            }

            state_.SentReset = false;
            state_.ReceivedReset = false;

            int msgSeqNum = logon.Header.GetInt(Fields.Tags.MsgSeqNum);
            if (IsTargetTooHigh(msgSeqNum) && !resetSeqNumFlag.Obj)
            {
                DoTargetTooHigh(logon, msgSeqNum);
            }
            else
            {
                state_.IncrNextTargetMsgSeqNum();
            }

            if (this.IsLoggedOn)
                this.Application.OnLogon(this.SessionID);
        }
コード例 #13
0
ファイル: Session.cs プロジェクト: kevholditch/quickfixn
        protected bool SendRaw(Message message, int seqNum)
        {
            
            lock (sync_)
            {
                string msgType = message.Header.GetField(Fields.Tags.MsgType);
                if (msgType == Fields.MsgType.HEARTBEAT)
                {
                    _log.Info("Sending heartbeat inside sendraw");
                }

                InitializeHeader(message, seqNum);

                if (Message.IsAdminMsgType(msgType))
                {
                    this.Application.ToAdmin(message, this.SessionID);

                    if (MsgType.LOGON.Equals(msgType) && !state_.ReceivedReset)
                    {
                        Fields.ResetSeqNumFlag resetSeqNumFlag = new QuickFix.Fields.ResetSeqNumFlag(false);
                        if (message.IsSetField(resetSeqNumFlag))
                            message.GetField(resetSeqNumFlag);
                        if (resetSeqNumFlag.getValue())
                        {
                            state_.Reset("ResetSeqNumFlag");
                            message.Header.SetField(new Fields.MsgSeqNum(state_.GetNextSenderMsgSeqNum()));
                        }
                        state_.SentReset = resetSeqNumFlag.Obj;
                    }
                }
                else
                {
                    try
                    {
                        this.Application.ToApp(message, this.SessionID);
                    }
                    catch (DoNotSend)
                    {
                        return false;
                    }
                }

                string messageString = message.ToString();
                if (0 == seqNum)
                    Persist(message, messageString);
                
                if (msgType == Fields.MsgType.HEARTBEAT)
                {
                    _log.Info("about to send that heartbeat for real");
                }

                return Send(messageString, msgType == Fields.MsgType.HEARTBEAT);
            }
        }