Пример #1
0
        /// <summary>
        /// Queues will be created if the user has specified a number of threads to be
        /// used, otherwise the default queue will be used.
        /// </summary>
        private void createQueues()
        {
            // Only continue if the number of threads required is greater than 0
            if (m_numberThreads > 0)
            {
                m_queueGroup = new MamaQueueGroup(m_bridge, m_numberThreads);

                if ((m_highWaterMark > 0) || (m_lowWaterMark > 0))
                {
                    ListenerQueueCallback queueCallback = new ListenerQueueCallback();

                    // Install the callback on each queue
                    for (int index = 0; index < m_numberThreads; index++)
                    {
                        MamaQueue queue = m_queueGroup.getNextQueue();

                        string queueName = ("QUEUE " + index);
                        Console.WriteLine("Setting monitor for " + queueName);

                        // Install the callbacks
                        queue.setQueueMonitorCallbacks(queueCallback, queueName);

                        // Set the watermarks at which the callbacks are invoked
                        if (m_highWaterMark > 0)
                        {
                            queue.setHighWatermark(m_highWaterMark);
                        }

                        if (m_lowWaterMark > 0)
                        {
                            // Not supported on all middlewares.
                            queue.setLowWatermark(m_lowWaterMark);
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Queues will be created if the user has specified a number of threads to be
        /// used, otherwise the default queue will be used.
        /// </summary>
        private void createQueues()
        {
            // Only continue if the number of threads required is greater than 0
            if (m_numberThreads > 0)
            {
                m_queueGroup = new MamaQueueGroup(m_bridge, m_numberThreads);

                if ((m_highWaterMark > 0) || (m_lowWaterMark > 0))
                {
                    ListenerQueueCallback queueCallback = new ListenerQueueCallback();

                    // Install the callback on each queue
                    for (int index = 0; index < m_numberThreads; index++)
                    {
                        MamaQueue queue = m_queueGroup.getNextQueue();

                        string queueName = ("QUEUE " + index);
                        Console.WriteLine("Setting monitor for " + queueName);

                        // Install the callbacks
                        queue.setQueueMonitorCallbacks(queueCallback, queueName);

                        // Set the watermarks at which the callbacks are invoked
                        if(m_highWaterMark > 0)
                        {
                            queue.setHighWatermark(m_highWaterMark);
                        }

                        if(m_lowWaterMark > 0)
                        {
                            // Not supported on all middlewares.
                            queue.setLowWatermark(m_lowWaterMark);
                        }
                    }
                }
            }
        }