Direct and topic exchanges are conceptually very similar to each other. The main difference is that direct exchanges use exact matching only to select the destination of the messages, while topic exchanges allow using pattern matching with specific wildcards.
For example, the BBC is using topic routing with RabbitMQ to route new stories to all of the appropriate RSS feeds on their websites.
You can find the example for a topic exchange at:
To use this recipe we need to set up the Java development environment as indicated in the Introduction section.
Let's start with the producer: