GetSessions() public method

public GetSessions ( ) : HashSet
return HashSet
コード例 #1
0
        public AbstractInitiator(
            IApplication app, IMessageStoreFactory storeFactory, SessionSettings settings, ILogFactory logFactory, IMessageFactory messageFactory)
        {
            _app = app;
            _storeFactory = storeFactory;
            _settings = settings;
            _logFactory = logFactory;
            _msgFactory = messageFactory;

            HashSet<SessionID> definedSessions = _settings.GetSessions();
            if (0 == definedSessions.Count)
                throw new ConfigError("No sessions defined");
        }
コード例 #2
0
        private void CreateSessions(SessionSettings settings)
        {
            foreach (SessionID sessionID in settings.GetSessions())
            {
                QuickFix.Dictionary dict = settings.Get(sessionID);
                string connectionType    = dict.GetString(SessionSettings.CONNECTION_TYPE);

                if ("acceptor".Equals(connectionType))
                {
                    AcceptorSocketDescriptor descriptor = GetAcceptorSocketDescriptor(settings, sessionID);
                    Session session = sessionFactory_.Create(sessionID, dict);
                    descriptor.AcceptSession(session);
                    sessions_[sessionID] = session;
                }
            }

            if (0 == socketDescriptorForAddress_.Count)
            {
                throw new ConfigError("No acceptor sessions found in SessionSettings.");
            }
        }
コード例 #3
0
        public AbstractInitiator(SessionFactory factory, SessionSettings settings)
        {
            settings_ = settings;

            HashSet<SessionID> definedSessions = settings.GetSessions();
            if (0 == definedSessions.Count)
                throw new ConfigError("No sessions defined");

            foreach (SessionID sessionID in definedSessions)
            {
                Dictionary dict = settings.Get(sessionID);
                if ("initiator".Equals(dict.GetString(SessionSettings.CONNECTION_TYPE)))
                {
                    sessionIDs_.Add(sessionID);
                    sessions_[sessionID] = factory.Create(sessionID, dict);
                    SetDisconnected(sessionID);
                }
            }

            if (0 == sessions_.Count)
                throw new ConfigError("No sessions defined for initiator");
        }
コード例 #4
0
        private void CreateSessions(SessionSettings settings, SessionFactory sessionFactory)
        {
            sessionFactory_ = sessionFactory;
            settings_ = settings;
            foreach (SessionID sessionID in settings.GetSessions())
            {
                QuickFix.Dictionary dict = settings.Get(sessionID);
                CreateSession(sessionID, dict);
            }

            if (0 == socketDescriptorForAddress_.Count)
                throw new ConfigError("No acceptor sessions found in SessionSettings.");
        }
コード例 #5
0
        private void CreateSessions(SessionSettings settings, SessionFactory sessionFactory)
        {
            foreach (SessionID sessionID in settings.GetSessions())
            {
                QuickFix.Dictionary dict = settings.Get(sessionID);
                string connectionType = dict.GetString(SessionSettings.CONNECTION_TYPE);

                if ("acceptor".Equals(connectionType))
                {
                    AcceptorSocketDescriptor descriptor = GetAcceptorSocketDescriptor(settings, sessionID);
                    Session session = sessionFactory.Create(sessionID, dict);
                    descriptor.AcceptSession(session);
                    sessions_[sessionID] = session;
                }
            }

            if (0 == socketDescriptorForAddress_.Count)
                throw new ConfigError("No acceptor sessions found in SessionSettings.");
        }
コード例 #6
0
        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"));
        }