concept direct exchange in category rabbitmq

appears as: direct exchge, The direct exchge, direct exchange, direct exchges
RabbitMQ in Depth

This is an excerpt from Manning's book RabbitMQ in Depth.

6.1. Simple message routing using the direct exchange

The direct exchange is useful when you’re going to deliver a message with a specific target, or a set of targets. Any queue that’s bound to an exchange with the same routing key that’s being used to publish a message will receive the message. RabbitMQ uses string equality when checking the binding and doesn’t allow any type of pattern matching when using a direct exchange (figure 6.1).

Figure 6.1. Using a direct exchange, messages published by publisher 1 will be routed to queue 1 and queue 2, whereas messages published by publisher 2 will be routed to queues 2 and 3.

As illustrated in figure 6.1, multiple queues can be bound to a direct exchange using the same routing key. Every queue bound with the same routing key will receive all of the messages published with that routing key.

The direct exchange type is built into RabbitMQ and doesn’t require any additional plugins. Creating a direct exchange is as simple as declaring an exchange type as “direct,” as demonstrated in this snippet in the “6.1 Direct Exchange” notebook.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest