コード例 #1
0
        public void Should_be_able_to_create_a_queue()
        {
            var vhost     = managementClient.GetVhost("/");
            var queueInfo = new QueueInfo(testQueue);
            var queue     = managementClient.CreateQueue(queueInfo, vhost);

            queue.Name.ShouldEqual(testQueue);
        }
コード例 #2
0
        protected internal override void Apply(IManagementClient managementClient)
        {
            _log.Info($"Declaring queue '{Name}' on '{VirtualHost}'");
            _log.Info($"    AutoDelete = {AutoDelete}");
            _log.Info($"    Durable = {Durable}");

            var vhost     = managementClient.GetVhost(VirtualHost);
            var arguments = new InputArguments();
            var queueInfo = new QueueInfo(Name, AutoDelete, Durable, arguments);

            if (MessageTTLDeclared)
            {
                _log.Info($"    MessageTTL = {MessageTTL}");
                arguments.Add("x-message-ttl", (long)MessageTTL.Value.TotalMilliseconds);
            }
            if (AutoExpireDeclared)
            {
                _log.Info($"    AutoExpire = {AutoExpire}");
                arguments.Add("x-expires", (long)AutoExpire.Value.TotalMilliseconds);
            }
            if (MaxLengthDeclared)
            {
                _log.Info($"    MaxLength = {MaxLength}");
                arguments.Add("x-max-length", MaxLength.Value);
            }
            if (MaxLengthBytesDeclared)
            {
                _log.Info($"    MaxLengthBytes = {MaxLengthBytes}");
                arguments.Add("x-max-length-bytes", MaxLengthBytes.Value);
            }
            if (DLXDeclared)
            {
                _log.Info($"    DeadLetterExchange = {DeadLetterExchange}");
                arguments.Add("x-dead-letter-exchange", DeadLetterExchange);
            }
            if (DLXRoutingKeyDeclared)
            {
                _log.Info($"    DeadLetterRoutingKey = {DeadLetterRoutingKey}");
                arguments.Add("x-dead-letter-routing-key", DeadLetterRoutingKey);
            }
            if (MaxPriorityDeclared)
            {
                _log.Info($"    MaxPriority = {MaximumPriority}");
                arguments.Add("x-max-priority", MaximumPriority.Value);
            }

            managementClient.CreateQueue(queueInfo, vhost);

            _log.Info($"Finished declaring queue '{Name}' on '{VirtualHost}'");
        }
 public async Task CreateQueue(string queuePath)
 {
     await _managementClient.CreateQueue(queuePath);
 }