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 InputArguments MapInputArguments(Model.Arguments arguments) { var mapping = new InputArguments(); foreach (var argument in arguments) mapping.Add(argument.Key, argument.Value); return mapping; }