4.9.2. Topic Exchange
A Topic Exchange routes messages based on the routing key (subject) of the message and the binding key of the subscription, just as a direct exchange does. The difference is that a topic exchange supports the use of wildcards in binding keys, allowing you to implement flexible routing schemas.
Figure 4.3. Topic Exchange
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
.