public IMessageCustomer CreateCustomer(string queueName)
 {
     IMessageCustomer customer;
     if (!Customers.ContainsKey(queueName))
     {
         customer = new MessageCustomer(queueName);
         Customers.Add(queueName, customer);
     }
     else
     {
         customer = Customers[queueName];
     }
     return customer;
 }
Esempio n. 2
0
        static void Main(string[] args)
        {

            Parallel.For(0, RabbitMQConfig.ThreadCount, i =>
            {
                IMessageCustomer customer = new MessageCustomer("test");
                customer.StartListening();
                customer.ReceiveMessageCallback = message =>
                {
                    Console.WriteLine("接收到消息:" + message);
                    return true;
                };
           });
            Console.Read();
        }