Esempio n. 1
0
        private void BindCurrentQueueToExchange(IModel channel)
        {
            if (ConnectionSetting.Exchange.IsNullOrWhitespace())
            {
                return;
            }

            channel.ExchangeDeclare(ConnectionSetting.Exchange, "topic", true);
            if (QueueName.IsNullOrWhitespace())
            {
                return;
            }

            channel.QueueDeclare(QueueName, MessageDurable, false, false, null);
            foreach (var item in BindRoutingKeyPattern.Split('|'))
            {
                channel.QueueBind(QueueName, ConnectionSetting.Exchange, item);
            }
        }