示例#1
0
        static void Main(string[] args)
        {
            AppLogger = new PerDayFileLogSource(Directory.GetCurrentDirectory() + "\\Log", Directory.GetCurrentDirectory() + "\\Log\\Backup")
            {
                FilePattern = "Log.{0:yyyy-MM-dd}.log",
                DeleteDays  = 20
            };

            string path = ConfigurationManager.AppSettings["InitiatorPath"];

            SessionSettings  = new SessionSettings(path);
            FileStoreFactory = new FileStoreFactory(SessionSettings);
            ScreenLogFactory = new ScreenLogFactory(SessionSettings);
            MessageFactory   = new QuickFix.FIX44.MessageFactory();

            Program myProgram = new Program();

            Initiator = new SocketInitiator(myProgram, FileStoreFactory, SessionSettings, ScreenLogFactory);

            Initiator.Start();


            Console.WriteLine("Initiator successfully started...");
            Console.ReadKey();
        }
示例#2
0
        public override bool Initialize(OnMessageReceived pOnPublishMessage, OnLogMessage pOnLogMsg, string configFile)
        {
            try
            {
                this.ModuleConfigFile  = configFile;
                this.DoPublishMessage += pOnPublishMessage;
                this.OnLogMsg         += pOnLogMsg;

                if (LoadConfig(configFile))
                {
                    SentOrders     = new Dictionary <string, string>();
                    SendersDict    = new Dictionary <int, string>();
                    KeysDict       = new Dictionary <int, string>();
                    TestingModules = new Dictionary <string, ICommunicationModule>();

                    FIXMessageCreator = new FIXMessageCreator();

                    string path = Configuration.InitiatorCfg;
                    TestingModulesInitialized = false;

                    SessionSettings  = new SessionSettings(path);
                    FileStoreFactory = new FileStoreFactory(SessionSettings);
                    ScreenLogFactory = new ScreenLogFactory(SessionSettings);
                    MessageFactory   = new QuickFix.FIX44.MessageFactory();

                    Initiator = new SocketInitiator(this, FileStoreFactory, SessionSettings, ScreenLogFactory);

                    Initiator.Start();

                    return(true);
                }
                else
                {
                    DoLog("Error initializing config file " + configFile, Constants.MessageType.Error);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                DoLog("Critic error initializing " + configFile + ":" + ex.Message, Constants.MessageType.Error);
                return(false);
            }
        }