예제 #1
0
        /// <summary>
        /// handle other socket options like TCP_NO_DELAY here
        /// </summary>
        /// <param name="settings"></param>
        protected override void OnConfigure(SessionSettings settings)
        {
            try
            {
                reconnectInterval_ = Convert.ToInt32(settings.Get().GetLong(SessionSettings.RECONNECT_INTERVAL));
            }
            catch (System.Exception)
            { }

            // Don't know if this is required in order to handle settings in the general section
            socketSettings_.Configure(settings.Get());
        }       
예제 #2
0
 /// <summary>
 /// handle other socket options like TCP_NO_DELAY here
 /// </summary>
 /// <param name="settings"></param>
 protected override void OnConfigure(SessionSettings settings)
 {
     try
     {
         reconnectInterval_ = Convert.ToInt32(settings.Get().GetLong(SessionSettings.RECONNECT_INTERVAL));
     }
     catch (System.Exception)
     { }
     if (settings.Get().Has(SessionSettings.SOCKET_NODELAY))
     {
         socketSettings_.SocketNodelay = settings.Get().GetBool(SessionSettings.SOCKET_NODELAY);
     }
 }
예제 #3
0
 /// FIXME handle other socket options like TCP_NO_DELAY here
 protected override void OnConfigure(SessionSettings settings)
 {
     try
     {
         reconnectInterval_ = Convert.ToInt32(settings.Get().GetLong(SessionSettings.RECONNECT_INTERVAL));
     }
     catch (System.Exception)
     { }
 }
예제 #4
0
 /// <summary>
 /// Creates a file-based message store
 /// </summary>
 /// <param name="sessionID">session ID for the message store</param>
 /// <returns></returns>
 public MessageStore Create(SessionID sessionID)
 {
     return(new FileStore(settings_.Get(sessionID).GetString(SessionSettings.FILE_STORE_PATH), sessionID));
 }
예제 #5
0
 public Log Create(SessionID sessionID)
 {
     return(new FileLog(settings_.Get(sessionID).GetString(SessionSettings.FILE_LOG_PATH), sessionID));
 }
        public void LoadSettingsWithDefaultSectionLast()
        {
            string configuration = new System.Text.StringBuilder()
                                   .AppendLine(partialConfiguration.ToString())
                                   .AppendLine("[DEFAULT]")
                                   .AppendLine("ConnectionType=initiator")
                                   .AppendLine("BeginString=FIX.4.0")
                                   .AppendLine("Value=4")
                                   .AppendLine("Empty=")
                                   .ToString();
            SessionSettings settings = new SessionSettings(new System.IO.StringReader(configuration));

            SessionID session1 = new SessionID("FIX.4.2", "ISLD", "TW");
            SessionID session2 = new SessionID("FIX.4.1", "ISLD", "WT");
            SessionID session3 = new SessionID("FIX.4.0", "ARCA", "TW");
            SessionID session4 = new SessionID("FIX.4.0", "ARCA", "WT");
            SessionID session5 = new SessionID("FIX.4.0", "NYSE", "TW", "QUAL1");
            SessionID session6 = new SessionID("FIX.4.0", "NYSE", "TW", "QUAL2");

            Assert.That(settings.Get().GetString("Empty"), Is.EqualTo(""));

            Assert.That(settings.Get().GetLong("Value"), Is.EqualTo(4));
            Assert.That(settings.Get(session1).GetLong("Value"), Is.EqualTo(1));
            Assert.That(settings.Get(session2).GetLong("Value"), Is.EqualTo(2));
            Assert.That(settings.Get(session3).GetLong("Value"), Is.EqualTo(3));
            Assert.That(settings.Get(session4).GetLong("Value"), Is.EqualTo(4));
            Assert.That(settings.Get(session5).GetLong("Value"), Is.EqualTo(5));
            Assert.That(settings.Get(session6).GetLong("Value"), Is.EqualTo(6));

            // case insensitivity
            Assert.That(settings.Get().GetLong("value"), Is.EqualTo(4));
            Assert.That(settings.Get(session1).GetLong("value"), Is.EqualTo(1));
            Assert.That(settings.Get(session2).GetLong("value"), Is.EqualTo(2));
            Assert.That(settings.Get(session3).GetLong("value"), Is.EqualTo(3));
            Assert.That(settings.Get(session4).GetLong("value"), Is.EqualTo(4));
            Assert.That(settings.Get(session5).GetLong("value"), Is.EqualTo(5));
            Assert.That(settings.Get(session6).GetLong("value"), Is.EqualTo(6));

            Assert.That(settings.Get().GetLong("VALUE"), Is.EqualTo(4));
            Assert.That(settings.Get(session1).GetLong("VALUE"), Is.EqualTo(1));
            Assert.That(settings.Get(session2).GetLong("VALUE"), Is.EqualTo(2));
            Assert.That(settings.Get(session3).GetLong("VALUE"), Is.EqualTo(3));
            Assert.That(settings.Get(session4).GetLong("VALUE"), Is.EqualTo(4));
            Assert.That(settings.Get(session5).GetLong("VALUE"), Is.EqualTo(5));
            Assert.That(settings.Get(session6).GetLong("VALUE"), Is.EqualTo(6));
        }
        public void testExtendedSettings()
        {
            string settingsString = new System.Text.StringBuilder()
                                    .AppendLine("[DEFAULT]")
                                    .AppendLine("ConnectionType=initiator")
                                    .AppendLine("HeartBtInt=60")
                                    .AppendLine("[SESSION]")
                                    .AppendLine("BeginString=FIX.4.2")
                                    .AppendLine("SenderCompID=Company")
                                    .AppendLine("SenderSubID=FixedIncome")
                                    .AppendLine("SenderLocationID=HongKong")
                                    .AppendLine("TargetCompID=CLIENT1")
                                    .AppendLine("TargetSubID=HedgeFund")
                                    .AppendLine("TargetLocationID=NYC")
                                    .AppendLine("SendRedundantResendRequests=Y")
                                    .AppendLine("MillisecondsInTimeStamp=Y")
                                    .AppendLine("EnableLastMsgSeqNumProcessed=Y")
                                    .AppendLine("MaxMessagesInResendRequest=2500")
                                    .AppendLine("StartTime=06:00:00")
                                    .AppendLine("EndTime=05:59:00")
                                    .ToString();

            SessionSettings settings = new SessionSettings(new System.IO.StringReader(settingsString));

            SessionID id = new SessionID("FIX.4.2", "Company", "FixedIncome", "HongKong", "CLIENT1", "HedgeFund", "NYC");

            Assert.That(settings.Get(id).GetString("HeartBtInt"), Is.EqualTo("60"));
            Assert.That(settings.Get(id).GetString("BeginString"), Is.EqualTo("FIX.4.2"));
            Assert.That(settings.Get(id).GetString("SenderCompID"), Is.EqualTo("Company"));
            Assert.That(settings.Get(id).GetString("SenderSubID"), Is.EqualTo("FixedIncome"));
            Assert.That(settings.Get(id).GetString("SenderLocationID"), Is.EqualTo("HongKong"));
            Assert.That(settings.Get(id).GetString("TargetCompID"), Is.EqualTo("CLIENT1"));
            Assert.That(settings.Get(id).GetString("TargetSubID"), Is.EqualTo("HedgeFund"));
            Assert.That(settings.Get(id).GetString("TargetLocationID"), Is.EqualTo("NYC"));
            Assert.That(settings.Get(id).GetString("SendRedundantResendRequests"), Is.EqualTo("Y"));
            Assert.That(settings.Get(id).GetString("MillisecondsInTimeStamp"), Is.EqualTo("Y"));
            Assert.That(settings.Get(id).GetString("EnableLastMsgSeqNumProcessed"), Is.EqualTo("Y"));
            Assert.That(settings.Get(id).GetString("MaxMessagesInResendRequest"), Is.EqualTo("2500"));
            Assert.That(settings.Get(id).GetString("StartTime"), Is.EqualTo("06:00:00"));
            Assert.That(settings.Get(id).GetString("EndTime"), Is.EqualTo("05:59:00"));
            id = null;
            foreach (SessionID sid in settings.GetSessions())
            {
                id = sid;
                break;
            }
            Assert.NotNull(id);
            Assert.That(id.BeginString, Is.EqualTo("FIX.4.2"));
            Assert.That(id.SenderCompID, Is.EqualTo("Company"));
            Assert.That(id.SenderSubID, Is.EqualTo("FixedIncome"));
            Assert.That(id.SenderLocationID, Is.EqualTo("HongKong"));
            Assert.That(id.TargetCompID, Is.EqualTo("CLIENT1"));
            Assert.That(id.TargetSubID, Is.EqualTo("HedgeFund"));
            Assert.That(id.TargetLocationID, Is.EqualTo("NYC"));
        }