コード例 #1
0
ファイル: MamdaBookSelfTest.cs プロジェクト: jacobraj/MAMA
        public static void Main(string[] args)
        {
            CommandLineProcessor options      = new CommandLineProcessor(args);
            MamaTransport        transport    = null;
            MamaQueue            defaultQueue = null;
            MamaDictionary       dictionary   = null;
            double               intervalSecs = options.getTimerInterval();
            if (options.hasLogLevel())
            {
                myLogLevel = options.getLogLevel();
                Mama.enableLogging(myLogLevel);
            }

            try
            {
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();

                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                mySource = new MamaSource();

                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                // We might as well also enforce strict checking of order book updates
                MamdaOrderBook.setStrictChecking(true);

                /*Get the Data Dictionary*/
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = "WOMBAT";
                dictionarySource.transport = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);
                MamdaOrderBookFields.setDictionary(dictionary, null);

                if (intervalSecs == 0)
                {
                    intervalSecs = 5;
                }

                foreach (string symbol in options.getSymbolList())
                {
                    BookSelfTest aSelfTest             = new BookSelfTest ();
                    MamdaOrderBookChecker aBookChecker = new MamdaOrderBookChecker(
                        transport,
                        defaultQueue,
                        aSelfTest,
                        options.getSource(),
                        symbol,
                        intervalSecs);
                    obookCheckers.Add(aBookChecker);

                }

                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Environment.Exit(1);
            }
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            CommandLineProcessor options      = new CommandLineProcessor(args);
            MamaTransport        transport    = null;
            MamaQueue            defaultQueue = null;
            MamaDictionary       dictionary   = null;
            double intervalSecs = options.getTimerInterval();

            if (options.hasLogLevel())
            {
                myLogLevel = options.getLogLevel();
                Mama.enableLogging(myLogLevel);
            }

            try
            {
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();

                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                mySource = new MamaSource();

                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                // We might as well also enforce strict checking of order book updates
                MamdaOrderBook.setStrictChecking(true);

                /*Get the Data Dictionary*/
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = "WOMBAT";
                dictionarySource.transport       = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);
                MamdaOrderBookFields.setDictionary(dictionary, null);

                if (intervalSecs == 0)
                {
                    intervalSecs = 5;
                }

                foreach (string symbol in options.getSymbolList())
                {
                    BookSelfTest          aSelfTest    = new BookSelfTest();
                    MamdaOrderBookChecker aBookChecker = new MamdaOrderBookChecker(
                        transport,
                        defaultQueue,
                        aSelfTest,
                        options.getSource(),
                        symbol,
                        intervalSecs);
                    obookCheckers.Add(aBookChecker);
                }

                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Environment.Exit(1);
            }
        }