Пример #1
0
        public void DeclareIncomingQueue(string name)
        {
            if (!Initialized)
            {
                throw new NotInitializedException();
            }

            if (Queues.Contains(name))
            {
                throw new QueueAlreadyExistsException(name);
            }

            ConnectionModel.QueueDeclare(queue: name,
                                         durable: false,
                                         exclusive: false,
                                         autoDelete: false,
                                         arguments: null);
            Queues.Add(name);
            CleanQueue(name);

            var consumer = new EventingBasicConsumer(ConnectionModel);

            consumer.Received += Receiver;
            ConnectionModel.BasicConsume(queue: name,
                                         autoAck: true,
                                         consumer: consumer);
        }