start() public static method

Start processing messages on the internal queue. This starts Mama's internal throttle, refresh logic, and other internal Mama processes as well as dispatching messages from the internal queue.

Mama.start( ) blocks until an invocation of Mama.stop() occurs. MAMA employs a reference count to track multiple calls to Mama.start() and Mama.stop(). The count is incremented every time Mama.start() is called and decremented when Mama.stop() is called. The first Mama.start() call does not unblock until the count reaches zero. This function is thread safe.

public static start ( Wombat.MamaBridge bridgeImpl ) : void
bridgeImpl Wombat.MamaBridge /// The bridge specific structure. ///
return void
コード例 #1
0
        private MamaSubscriberCS(string[] args)
        {
            try
            {
                if (parseCommandLine(args))
                {
                    mamaBridge = Mama.loadBridge(middlewareName);

                    Mama.open();

                    mamaTransport = new MamaTransport();
                    mamaTransport.setTransportCallback(this);
                    mamaTransport.create(transportName, mamaBridge);

                    mamaDefaultQueue = Mama.getDefaultEventQueue(mamaBridge);

                    mamaSubscription = new MamaSubscription();
                    mamaSubscription.createBasic(
                        mamaTransport,
                        mamaDefaultQueue,
                        this,   // callback
                        topicName);

                    Console.WriteLine("Starting mama...");
                    Mama.start(mamaBridge);

                    // Prevent over-enthusiastic GC from reclaiming transport object
                    GC.KeepAlive(mamaTransport);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #2
0
        public int Run()
        {
            ParseArgs();
            if (helpNeeded)
            {
                DisplayUsage();
                return(0);
            }

            Mama.logToFile(@"mama.log", MamaLogLevel.MAMA_LOG_LEVEL_FINEST);
            bridge = Mama.loadBridge(middlewareName);
            Mama.open();
            MamaTransport    transport    = new MamaTransport();
            MamaQueue        defaultQueue = Mama.getDefaultEventQueue(bridge);
            MamaTimer        timer        = new MamaTimer();
            MamaSubscription subscription = new MamaSubscription();
            MamaPublisherCS  publisher    = this;

            transport.create(transportName, bridge);
            timer.create(defaultQueue, publisher, interval, null);
            subscription.createBasic(transport, defaultQueue, publisher, inboundTopic);
            publisher.create(transport, outboundTopic);
            msg = new MamaMsg();

            Mama.start(bridge);
            Mama.close();
            return(0);
        }
コード例 #3
0
        public int Run()
        {
            ParseArgs();
            if (helpNeeded)
            {
                DisplayUsage();
                return(0);
            }

            Mama.logToFile(@"mama.log", MamaLogLevel.MAMA_LOG_LEVEL_NORMAL);

            bridge = Mama.loadBridge(middlewareName);

            Mama.open();

            MamaQueue defaultQueue = Mama.getDefaultEventQueue(bridge);

            msg = new MamaMsg();

            MamaTimer timer = new MamaTimer();

            timer.create(defaultQueue, this, interval, null);

            queueGroup = new MamaQueueGroup(bridge, 1);

            MamaTransport transport = new MamaTransport();

            transport.create(transportName, bridge);

            MamaSubscription subscription = null;

            if (nosub == false)
            {
                subscription = new MamaSubscription();
                subscription.createBasic(transport, defaultQueue, this, inboundTopic);
            }

            publisher = new MamaPublisher();
            if (pubCb)
            {
                publisher.createWithCallbacks(transport, queueGroup.getNextQueue(), this, null, outboundTopic, null, null);
            }
            else
            {
                publisher.create(transport, outboundTopic);
            }

            Mama.start(bridge);

            Mama.close();

            return(0);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            try
            {
                MamaFtMemberCS ftDemo = new MamaFtMemberCS();
                ftDemo.parseCommandLine(args);

                ftDemo.init();

                Mama.start(ftDemo.myBridge);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #5
0
        public int Run()
        {
            ParseArgs();
            if (helpNeeded)
            {
                DisplayUsage();
                return(0);
            }

            InitializeMama();
            CreatePublisher();
            CreateInbox();

            for (int i = 0; i < 1000; ++i)
            {
                SendRequest();
            }

            Mama.start(bridge);

            return(0);
        }
コード例 #6
0
ファイル: MamaIoCS.cs プロジェクト: vitya-maleyev/OpenMAMA
        public int Run()
        {
            ParseArgs();
            if (helpNeeded)
            {
                DisplayUsage();
                return(0);
            }

            InitializeMama();
            WaitForConnection();
            CreateIoHandlers();

            Mama.start(bridge);

            readHandler.destroy();
            writeHandler.destroy();
            exceptHandler.destroy();

            client.Shutdown(SocketShutdown.Both);
            client.Close();

            return(0);
        }
コード例 #7
0
 public void dispatch()
 {
     Mama.start(myBridge);
 }