/// <summary> /// This function will run the application and create market data subscriptions. /// </summary> /// <param name="args"> /// Command line arguments. /// </param> internal void run(string[] args) { // Install an event handler to capture the Ctrl-C press NativeMethods.ControlEventHandler eventHandler = new NativeMethods.ControlEventHandler(this.onControlHandler); NativeMethods.SetConsoleCtrlHandler(eventHandler, true); // Parse the command line arguments bool shouldContinue = parseCommandLine(args); if (shouldContinue) { initializeMama(); try { createSubscriptions(); try { // Create a shutdown timer if appropriate if (m_shutdownTime > 0) { // The timer will be destroyed whenever it ticks MamaTimer shutdownTimer = new MamaTimer(); shutdownTimer.create(m_defaultQueue, new ListenShutdownTimerCallback(m_bridge), m_shutdownTime, null); } // Start the bridge, this call will block until either Ctrl C is pressed or the shutdown timer ticks Mama.start(m_bridge); } finally { destroySubscriptions(); } } finally { // Clean up mama uninitializeMama(); } } }