Example #1
0
        public static void Main(string[] args)
        {
            MamaTransport        transport          = null;
            MamaTransport        dictTransport      = null;
            string               dictTransportName  = null;
            MamaQueue            defaultQueue       = null;
            MamaDictionary       dictionary         = null;
            CommandLineProcessor options            = new CommandLineProcessor(args);

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

            try
            {
                // Initialize MAMDA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();
                transport = new MamaTransport();
                myMamaSource = new MamaSource ();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = "WOMBAT";
                dictTransportName = options.getDictTransport();
                if (null != dictTransportName)
                {
                    dictTransport = new MamaTransport();
                    dictTransport.create(dictTransportName, myBridge);
                }
                else
                {
                    dictTransport = transport;
                }
                dictionarySource.transport = dictTransport;

                /*Get the data dictionary*/
                dictionary = buildDataDictionary(dictTransport, defaultQueue, dictionarySource);

                MamdaSecurityStatusFields.setDictionary(dictionary, null);

                foreach (string symbol in options.getSymbolList())
                {
                    MamdaSubscription  aSubscription =  new MamdaSubscription();
                    MamdaSecurityStatusListener aSecListener = new MamdaSecurityStatusListener();
                    SecTicker        aTicker        = new SecTicker();

                    aSecListener.addHandler(aTicker);
                    aSubscription.addMsgListener(aSecListener);

                    aSubscription.create(transport,
                                        defaultQueue,
                                        options.getSource (),
                                        symbol,
                                        null);
                }

                Console.WriteLine("Hit Enter or Ctrl-C to exit.");
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
Example #2
0
        public static void Main(string[] args)
        {
            MamaTransport        transport         = null;
            MamaTransport        dictTransport     = null;
            string               dictTransportName = null;
            MamaQueue            defaultQueue      = null;
            MamaDictionary       dictionary        = null;
            CommandLineProcessor options           = new CommandLineProcessor(args);

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

            try
            {
                // Initialize MAMDA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();
                transport    = new MamaTransport();
                myMamaSource = new MamaSource();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = "WOMBAT";
                dictTransportName = options.getDictTransport();
                if (null != dictTransportName)
                {
                    dictTransport = new MamaTransport();
                    dictTransport.create(dictTransportName, myBridge);
                }
                else
                {
                    dictTransport = transport;
                }
                dictionarySource.transport = dictTransport;

                /*Get the data dictionary*/
                dictionary = buildDataDictionary(dictTransport, defaultQueue, dictionarySource);

                MamdaSecurityStatusFields.setDictionary(dictionary, null);

                foreach (string symbol in options.getSymbolList())
                {
                    MamdaSubscription           aSubscription = new MamdaSubscription();
                    MamdaSecurityStatusListener aSecListener  = new MamdaSecurityStatusListener();
                    SecTicker aTicker = new SecTicker();

                    aSecListener.addHandler(aTicker);
                    aSubscription.addMsgListener(aSecListener);

                    aSubscription.create(transport,
                                         defaultQueue,
                                         options.getSource(),
                                         symbol,
                                         null);
                }

                Console.WriteLine("Hit Enter or Ctrl-C to exit.");
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
        public static void Main(string[] args)
        {
            MamaTransport        transport    = null;
            MamaQueue            defaultQueue = null;
            MamaDictionary       dictionary   = null;
            CommandLineProcessor options      = new CommandLineProcessor(args);

            myQuietModeLevel = options.getQuietModeLevel();

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

            try
            {
                // Initialize MAMDA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();
                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                /*Get the data dictionary*/
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = options.getDictSource();
                dictionarySource.transport       = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);

                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);
                MamdaSecurityStatusFields.setDictionary(dictionary, null);

                mamdaSubscriptions = new MamdaSubscription [options.getSymbolList().Count];
                int i = 0;
                foreach (string symbol in options.getSymbolList())
                {
                    mamdaSubscriptions[i] = new MamdaSubscription();

                    MamdaTradeListener          aTradeListener          = new MamdaTradeListener();
                    MamdaQuoteListener          aQuoteListener          = new MamdaQuoteListener();
                    MamdaSecurityStatusListener aSecurityStatusListener = new MamdaSecurityStatusListener();
                    ComboTicker aTicker = new ComboTicker();

                    aTradeListener.addHandler(aTicker);
                    aQuoteListener.addHandler(aTicker);
                    aSecurityStatusListener.addHandler(aTicker);
                    mamdaSubscriptions[i].addMsgListener(aTradeListener);
                    mamdaSubscriptions[i].addMsgListener(aQuoteListener);
                    mamdaSubscriptions[i].addStaleListener(aTicker);
                    mamdaSubscriptions[i].addErrorListener(aTicker);

                    mamdaSubscriptions[i].create(transport,
                                                 defaultQueue,
                                                 options.getSource(),
                                                 symbol,
                                                 null /*Closure*/);

                    i++;
                }

                Console.WriteLine("Hit Enter or Ctrl-C to exit.");
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
Example #4
0
        public static void Main(string[] args)
        {
            MamaTransport        transport    = null;
            MamaQueue            defaultQueue = null;
            MamaDictionary       dictionary   = null;
            CommandLineProcessor options      = new CommandLineProcessor(args);
            myQuietModeLevel = options.getQuietModeLevel();

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

            try
            {
                // Initialize MAMDA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();
                transport = new MamaTransport();
                transport.create(options.getTransport(), myBridge);
                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                /*Get the data dictionary*/
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = options.getDictSource();
                dictionarySource.transport = transport;
                dictionary = buildDataDictionary(transport, defaultQueue, dictionarySource);

                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);
                MamdaSecurityStatusFields.setDictionary(dictionary, null);

                mamdaSubscriptions = new MamdaSubscription [options.getSymbolList().Count];
                int i=0;
                foreach (string symbol in options.getSymbolList())
                {
                    mamdaSubscriptions[i] =  new MamdaSubscription();

                    MamdaTradeListener aTradeListener = new MamdaTradeListener();
                    MamdaQuoteListener aQuoteListener = new MamdaQuoteListener();
                    MamdaSecurityStatusListener aSecurityStatusListener = new MamdaSecurityStatusListener();
                    ComboTicker        aTicker        = new ComboTicker();

                    aTradeListener.addHandler(aTicker);
                    aQuoteListener.addHandler(aTicker);
                    aSecurityStatusListener.addHandler(aTicker);
                    mamdaSubscriptions[i].addMsgListener(aTradeListener);
                    mamdaSubscriptions[i].addMsgListener(aQuoteListener);
                    mamdaSubscriptions[i].addStaleListener(aTicker);
                    mamdaSubscriptions[i].addErrorListener(aTicker);

                    mamdaSubscriptions[i].create(transport,
                        defaultQueue,
                        options.getSource(),
                        symbol,
                        null/*Closure*/);

                    i++;
                }

                Console.WriteLine("Hit Enter or Ctrl-C to exit.");
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }