diff --git a/config/config.go b/config/config.go index 798b7c6..cbac3f3 100644 --- a/config/config.go +++ b/config/config.go @@ -26,6 +26,7 @@ type Config struct { MessageTTL int DeadLetterExchange string DeadLetterRoutingKey string + Priority int } Exchange struct { Name string diff --git a/consumer/consumer.go b/consumer/consumer.go index c4ba19a..2c66a82 100644 --- a/consumer/consumer.go +++ b/consumer/consumer.go @@ -298,6 +298,10 @@ func sanitizeQueueArgs(cfg *config.Config) amqp.Table { } } + if cfg.QueueSettings.Priority > 0 { + args["x-max-priority"] = int32(cfg.QueueSettings.Priority) + } + if len(args) > 0 { return args } diff --git a/example.conf b/example.conf index ffafb61..b939f72 100644 --- a/example.conf +++ b/example.conf @@ -22,6 +22,7 @@ routingkey=somekey messagettl=30000 deadLetterExchange=someexchange deadLetterroutingkey=someroutingkey +priority=10 [logs] error = /tmp/error.log