Ejemplo n.º 1
0
        protected virtual void DeclareQueue(IModel channel)
        {
            if (this.DispatchOnly)
            {
                return;
            }

            var declarationArgs = new Dictionary <string, object>();

            if (this.DeadLetterExchange != null)
            {
                declarationArgs[DeadLetterExchangeDeclaration] = this.DeadLetterExchange.ExchangeName;
            }

            if (this.Clustered)
            {
                declarationArgs[ClusteredQueueDeclaration] = ReplicateToAllNodes;
            }

            var inputQueue = this.InputQueue;

            if (this.RandomInputQueue)
            {
                inputQueue = string.Empty;
            }

            var declaration = channel.QueueDeclare(
                inputQueue, this.DurableQueue, this.ExclusiveQueue, this.AutoDelete, declarationArgs);

            if (declaration != null)
            {
                this.InputQueue = declaration.QueueName;
            }

            if (!this.ReturnAddressSpecified)
            {
                this.ReturnAddress = new Uri(DefaultReturnAddressFormat.FormatWith(this.InputQueue));
            }

            if (this.PurgeOnStartup)
            {
                channel.QueuePurge(this.InputQueue);
            }

            channel.BasicQos(0, (ushort)this.ChannelBuffer, false);
        }
Ejemplo n.º 2
0
        public virtual RabbitChannelGroupConfiguration WithInputQueue(string name, bool clustered = false)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            name = name.NormalizeName();

            if (!this.ReturnAddressSpecified)
            {
                this.ReturnAddress = new Uri(DefaultReturnAddressFormat.FormatWith(name));
            }

            this.InputQueue   = name;
            this.AutoDelete   = this.AutoDelete || this.InputQueue.Length == 0;
            this.DispatchOnly = false;
            this.GroupName    = this.GroupName == DefaultGroupName ? name : this.GroupName;
            this.Clustered    = clustered;

            return(this);
        }