Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter out unsupported policies #600

Merged
merged 3 commits into from
Nov 24, 2023
Merged
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions src/lavinmq/policy.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module LavinMQ
end

class Policy
SUPPORTED_POLICIES = ["max-length", "max-length-bytes", "message-ttl", "expires", "overflow",
kickster97 marked this conversation as resolved.
Show resolved Hide resolved
"dead-letter-exchange", "dead-letter-routing-key", "federation-upstream",
"federation-upstream-set", "delivery-limit", "max-age",
"alternate-exchange", "delayed-message"]
enum Target
All
Queues
Expand Down Expand Up @@ -67,15 +71,15 @@ module LavinMQ
merged[k] = v
end
end
merged
merged.select { |key, _| SUPPORTED_POLICIES.includes?(key) }
end

def self.merge_definitions(p1 : Nil, p2 : Policy) : Hash(String, JSON::Any)
p2.definition
p2.definition.select { |key, _| SUPPORTED_POLICIES.includes?(key) }
end

def self.merge_definitions(p1 : Policy, p2 : Nil) : Hash(String, JSON::Any)
p1.definition
p1.definition.select { |key, _| SUPPORTED_POLICIES.includes?(key) }
end

def self.merge_definitions(p1 : Nil, p2 : Nil) : Hash(String, JSON::Any)
Expand Down
Loading