Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Add new queuesettings for message priority #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Config struct {
MessageTTL int
DeadLetterExchange string
DeadLetterRoutingKey string
Priority int
}
Exchange struct {
Name string
Expand Down
4 changes: 4 additions & 0 deletions consumer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ routingkey=somekey
messagettl=30000
deadLetterExchange=someexchange
deadLetterroutingkey=someroutingkey
priority=10

[logs]
error = /tmp/error.log
Expand Down