Example #1
0
        //TODO:判断连接失败
        public static WorkQueueConsumer createInstance(IRabbitMqFactory factory, string queueName)
        {
            WorkQueueConsumer instance = new WorkQueueConsumer();

            instance.mConnection = factory.CreateConnection();
            instance.mChannel    = instance.mConnection.CreateChannel();
            instance.mQueueName  = queueName;
            instance.mChannel.QueueDeclare(queue: instance.mQueueName, durable: true, exclusive: false, autoDelete: false, arguments: null);
            instance.mConsumer = instance.mChannel.GetEventingBasicConsumer();
            return(instance);
        }
Example #2
0
 public IMQConsumer CreateMqConsumer(string routingKey)
 {
     return((IMQConsumer)(WorkQueueConsumer.createInstance(this, routingKey)));
 }