public SessionFactory(Application app, MessageStoreFactory storeFactory, LogFactory logFactory, IMessageFactory messageFactory)
 {
     application_ = app;
     messageStoreFactory_ = storeFactory;
     logFactory_ = logFactory;
     messageFactory_ = messageFactory ?? new DefaultMessageFactory();
 }
Exemple #2
0
        public Initiator(Application app, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory)
        {
            settings_ = settings;

            HashSet <SessionID> definedSessions = settings.GetSessions();

            if (0 == definedSessions.Count)
            {
                throw new ConfigError("No sessions defined");
            }

            SessionFactory factory = new SessionFactory(app, storeFactory, logFactory);

            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");
            }
        }
 public SocketInitiator(Application application, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory)
     : base(application, storeFactory, settings, logFactory)
 {
     app_          = application;
     storeFactory_ = storeFactory;
     settings_     = settings;
     logFactory_   = logFactory;
 }
 public SocketInitiator(Application application, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory)
     : base(application, storeFactory, settings, logFactory)
 {
     app_ = application;
     storeFactory_ = storeFactory;
     settings_ = settings;
     logFactory_ = logFactory;
 }
Exemple #5
0
        /// FIXME
        public Session(
            Application app, MessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider,
            SessionSchedule sessionSchedule, int heartBtInt, LogFactory logFactory, IMessageFactory msgFactory)
        {
            this.Application            = app;
            this.SessionID              = sessID;
            this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
            this.schedule_              = sessionSchedule;
            this.msgFactory_            = msgFactory;

            this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString);
            if (this.SessionID.IsFIXT)
            {
                this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID);
            }
            else
            {
                this.ApplicationDataDictionary = this.SessionDataDictionary;
            }

            Log log;

            if (null != logFactory)
            {
                log = logFactory.Create(sessID);
            }
            else
            {
                log = new NullLog();
            }

            state_ = new SessionState(log, heartBtInt);
            state_.MessageStore = storeFactory.Create(sessID);

            this.PersistMessages             = true;
            this.ResetOnDisconnect           = false;
            this.SendRedundantResendRequests = false;
            this.ValidateLengthAndChecksum   = true;
            this.CheckCompID = true;

            if (!CheckSessionTime())
            {
                Reset();
            }

            lock (sessions_)
            {
                sessions_[this.SessionID] = this;
            }

            this.Application.OnCreate(this.SessionID);
            this.Log.OnEvent("Created session");
        }
Exemple #6
0
        public Session(
            Application app, MessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider,
            SessionSchedule sessionSchedule, int heartBtInt, LogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID)
        {
            this.Application = app;
            this.SessionID = sessID;
            this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
            this.schedule_ = sessionSchedule;
            this.msgFactory_ = msgFactory;

            this.SenderDefaultApplVerID = senderDefaultApplVerID;

            this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString);
            if (this.SessionID.IsFIXT)
                this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID);
            else
                this.ApplicationDataDictionary = this.SessionDataDictionary;

            Log log;
            if (null != logFactory)
                log = logFactory.Create(sessID);
            else
                log = new NullLog();

            state_ = new SessionState(log, heartBtInt)
            {
                MessageStore = storeFactory.Create(sessID)
            };

            this.PersistMessages = true;
            this.ResetOnDisconnect = false;
            this.SendRedundantResendRequests = false;
            this.ValidateLengthAndChecksum = true;
            this.CheckCompID = true;
            this.MillisecondsInTimeStamp = true;
            this.EnableLastMsgSeqNumProcessed = false;
            this.MaxMessagesInResendRequest = 0;
            this.SendLogoutBeforeTimeoutDisconnect = false;
            this.IgnorePossDupResendRequests = false;

            if (!IsSessionTime)
                Reset("Out of SessionTime at construction");
            else if (IsNewSession)
                Reset("New session");

            lock (sessions_)
            {
                sessions_[this.SessionID] = this;
            }

            this.Application.OnCreate(this.SessionID);
            this.Log.OnEvent("Created session");
        }
Exemple #7
0
        /// FIXME
        public Session(
            Application app, MessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider,
            SessionSchedule sessionSchedule, int heartBtInt, LogFactory logFactory, IMessageFactory msgFactory)
        {
            this.Application = app;
            this.SessionID = sessID;
            this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
            this.schedule_ = sessionSchedule;
            this.msgFactory_ = msgFactory;

            this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString);
            if (this.SessionID.IsFIXT)
                this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID);
            else
                this.ApplicationDataDictionary = this.SessionDataDictionary;

            Log log;
            if (null != logFactory)
                log = logFactory.Create(sessID);
            else
                log = new NullLog();

            state_ = new SessionState(log, heartBtInt);
            state_.MessageStore = storeFactory.Create(sessID);

            this.PersistMessages = true;
            this.ResetOnDisconnect = false;
            this.SendRedundantResendRequests = false;
            this.ValidateLengthAndChecksum = true;
            this.CheckCompID = true;

            if (!CheckSessionTime())
                Reset();

            lock (sessions_)
            {
                sessions_[this.SessionID] = this;
            }

            this.Application.OnCreate(this.SessionID);
            this.Log.OnEvent("Created session");
        }
        public AbstractInitiator(Application app, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory, IMessageFactory messageFactory)
        {
            settings_ = settings;

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

            SessionFactory factory = new SessionFactory(app, storeFactory, logFactory, messageFactory);
            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");
        }
 public SessionFactory(Application app, MessageStoreFactory storeFactory, LogFactory logFactory)
     : this(app, storeFactory, logFactory, null)
 {
 }
 public SessionFactory(Application app, MessageStoreFactory storeFactory, LogFactory logFactory)
 {
     application_ = app;
     messageStoreFactory_ = storeFactory;
     logFactory_ = logFactory;
 }
 public SocketInitiator(Application application, MessageStoreFactory storeFactory, SessionSettings settings)
     : this(application, storeFactory, settings, null)
 {
 }
 public void GetCustomMessageStore_ReturnsNamedMessageStore()
 {
     ValidationCatalog.Configure(x => x.AddMessageStore(new ResourceMessageStore(TestRuleErrorMessages.ResourceManager), "MyMessageStore"));
     Assert.That(MessageStoreFactory.GetMessageStore("MyMessageStore"), Is.InstanceOf(typeof(ResourceMessageStore)));
 }
 public AbstractInitiator(Application app, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory)
     : this(app, storeFactory, settings, logFactory, null)
 {
 }
Exemple #14
0
 public SessionFactory(Application app, MessageStoreFactory storeFactory)
     : this(app, storeFactory, null)
 {
 }
Exemple #15
0
 public ThreadedSocketAcceptor(Application application, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory)
     : this(new SessionFactory(application, storeFactory, logFactory), settings)
 {
 }
        public void GetMessageStore_ReturnsOverriddenDefaultMessageStore()
        {
            ValidationCatalog.Configure(x => x.DefaultMessageStore = new SimpleMessageStore());

            Assert.That(MessageStoreFactory.GetAllMessageStores().First(), Is.InstanceOf(typeof(SimpleMessageStore)));
        }
 public AbstractInitiator(Application application, MessageStoreFactory storeFactory, SessionSettings settings)
     : this(application, storeFactory, settings, null)
 {
 }
Exemple #18
0
 public SessionFactory(Application app, MessageStoreFactory storeFactory, LogFactory logFactory)
 {
     application_         = app;
     messageStoreFactory_ = storeFactory;
     logFactory_          = logFactory;
 }
 public ThreadedSocketAcceptor(Application application, MessageStoreFactory storeFactory, SessionSettings settings, LogFactory logFactory)
     : this(new SessionFactory(application, storeFactory, logFactory), settings)
 {
 }
 public void GetMessageStore_ReturnsDefaultMessageStore()
 {
     Assert.That(MessageStoreFactory.GetAllMessageStores().First(), Is.InstanceOf(typeof(ResourceMessageStore)));
 }