From the course: Learning RabbitMQ

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Filter messages with topic exchanges

Filter messages with topic exchanges - RabbitMQ Tutorial

From the course: Learning RabbitMQ

Start my 1-month free trial

Filter messages with topic exchanges

- [Instructor] The topic exchange allows for fine-grained filtering of messages based on the routing key that is sent along with the message. We currently have a web application that sends out two types of messages. One with the routing key tour.booked, and another with tour.cancelled. With a direct exchange, we were able to filter out the tour.cancelled messages. Our email service will only receive messages where the routing key matches tour.booked exactly. What if we have another service, that needs to receive both messages? Let's say there is a back office application where both bookings and cancellations need to arrive. With direct exchanges, we would need to add two bindings, one for tour.booked and another for tour.cancelled. A better approach is to use the topic exchange. With topic exchanges, the email service can still bind using the routing key tour.booked, and will only receive those messages. But the back…

Contents