Exemplo n.º 1
0
        public void Start()
        {
            Broker[] brokers       = config.GetBrokers();
            int      consumerCount = config.consumerCount;

            if (brokers.Length < 1 || consumerCount < 1)
            {
                return;
            }

            this.brokerConsumerThreads = new ConsumerThread[brokers.Length][];
            for (int i = 0; i < brokers.Length; i++)
            {
                ConsumerThread[] threads = new ConsumerThread[consumerCount];
                this.brokerConsumerThreads[i] = threads;
                for (int j = 0; j < consumerCount; j++)
                {
                    ServiceConfig myConfig = (ServiceConfig)this.config.Clone();
                    myConfig.broker = brokers[i];

                    ConsumerThreadStart start  = new ConsumerThreadStart(myConfig);
                    ConsumerThread      thread = new ConsumerThread(start);
                    thread.Start();
                    threads[j] = thread;
                }
            }

            log.InfoFormat("Service({0}) started", config.mq);
        }
Exemplo n.º 2
0
 public ConsumerThread(ConsumerThreadStart threadStart)
 {
     this.threadStart = threadStart;
     this.thread      = new Thread(this.threadStart.Run);
 }