예제 #1
0
 public void Init()
 {
     this.queueList = new List <QueueInfo>();
     if (originQueueList?.Count > 0)
     {
         foreach (var q in originQueueList)
         {
             this.queueList.Add(BuildQueueInfo(q));
         }
     }
     else if (!string.IsNullOrEmpty(queue))
     {
         if (queueCount == 1)
         {
             queueList.Add(BuildQueueInfo(queue));
         }
         else
         {
             for (int i = 0; i < QueueCount; i++)
             {
                 queueList.Add(BuildQueueInfo(queue + "_" + i));
             }
         }
     }
     //申明exchange
     RabbitMQClient.ExchangeDeclare(this.exchange).Wait();
 }
예제 #2
0
 public void Init()
 {
     for (int i = 0; i < QueueCount; i++)
     {
         nodeList.Add(Queue + "_" + i);
     }
     _CHash = new ConsistentHash(nodeList, QueueCount * 10);
     //申明exchange
     RabbitMQClient.ExchangeDeclare(this.Exchange).Wait();
 }