8.3.12. Routing Key Wildcards
Topic Exchange match logic is used for ACL rules containing a
routingkey
property. These rules include:
- bind exchange <name> routingkey=X
- unbind exchange <name> routingkey=X
- publish exchange <name> routingkey=X
The
routingkey
property is now matched using the same logic as the Topic Exchange match. This allows administrators to express user limits in flexible terms that map to the namespace where routingkey
values are used.
Wildcard matching and Topic Exchanges
In the binding key,
#
matches any number of period-separated terms, and *
matches a single term.
So a binding key of
#.news
will match messages with subjects such as usa.news
and germany.europe.news
, while a binding key of *.news
will match messages with the subject usa.news
, but not germany.europe.news
.
Example:
The following ACL rules:
acl allow-log uHash1@COMPANY publish exchange name=X routingkey=a.#.b acl deny all all
Produce the following results when user
uHash1@COMPANY
publishes to exchange X:
routingkey in publish to exchange X | result |
---|---|
a.b
|
allow-log
|
a.x.b
|
allow-log
|
a..x.y.zz.b
|
allow-log
|
a.b.
|
deny
|
q.x.b
|
deny
|