setOutboundThrottle() public method

Set the throttle rate.
public setOutboundThrottle ( MamaThrottleInstance instance, double outboundThrottle ) : void
instance MamaThrottleInstance
outboundThrottle double
return void
Ejemplo n.º 1
0
        private void initializeMama()
        {
            mamaBridge = Mama.loadBridge(mamaMiddlewareName);

            Console.WriteLine(Mama.getVersion(mamaBridge));

            Mama.open();

            if (mamaHighWaterMark > 0 || mamaLowWaterMark > 0)
            {
                if (mamaHighWaterMark > 0)
                {
                    Mama.setDefaultQueueHighWatermark(mamaHighWaterMark);
                }

                if (mamaLowWaterMark > 0)
                {
                    try
                    {
                        Mama.setDefaultQueueLowWatermark(mamaLowWaterMark);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Could not set default queue low water mark MamaStatus: " + e);
                    }
                }
            }

            // create the transport
            mamaTransport = new MamaTransport();

            mamaTransport.setTransportCallback(this);

            // the default throttle rate is 500 msg/sec
            if (mamaThrottle != -1)
            {
                mamaTransport.setOutboundThrottle(MamaTransport.MamaThrottleInstance.MAMA_THROTTLE_DEFAULT, mamaThrottle);
            }

            // the default recap throttle rate is 250 msg/sec
            if (mamaRecapThrottle != -1)
            {
                mamaTransport.setOutboundThrottle(MamaTransport.MamaThrottleInstance.MAMA_THROTTLE_RECAP, mamaRecapThrottle);
            }

            mamaTransport.create(mamaTransportName, mamaBridge);

            // create default queue and, if required, queue group
            createQueues();

            mamaDictionarySource = new MamaSource();
            mamaDictionarySource.symbolNamespace = mamaDictionarySourceName;
            mamaDictionarySource.transport = mamaTransport;

            // download dictionary
            mamaDictionary = new MamaDictionary();

            mamaDictionary.create(
                mamaDefaultQueue,
                this,
                mamaDictionarySource,
                3,
                10.0f);

            loadSymbolMap();

            Mama.start(mamaBridge);

            if (!dictionaryComplete)
            {
                throw new Exception("Can't create dictionary.");
            }

        }
Ejemplo n.º 2
0
        /// <summary>
        /// This function will create the mama transport using the values specified in the member
        /// variables.
        /// </summary>
        private void createTransport()
        {
            m_transport = new MamaTransport();

            // Register for the callbacks before the transport is created
            m_transport.setTransportCallback(new ListenerTransportCallback());

            // Set the throttle rate if one has been specified, note that 0 is valid and turns the throttle off
            if(m_throttleRate != -1)
            {
                m_transport.setOutboundThrottle(MamaTransport.MamaThrottleInstance.MAMA_THROTTLE_DEFAULT, m_throttleRate);
            }

            // Set the recap throttle rate if one has been specified, note that 0 is valid and turns the throttle off
            if(m_recapThrottleRate != -1)
            {
                m_transport.setOutboundThrottle(MamaTransport.MamaThrottleInstance.MAMA_THROTTLE_RECAP, m_recapThrottleRate);
            }

            // Create the transport now that everything has been set
            m_transport.create(m_transportName, m_bridge);
        }