On 3 December 2014 at 02:17:38,
shal...@gmail.com (
shal...@gmail.com) wrote:
> Suppose I a have a fanout exchange replicated across hundreds
> of nodes. On each node, there are queues bound to the fanout exchange
> with different routing keys.
Fanout exchanges do not use routing keys. A copy is unconditionally placed into every
queue bound. Are you sure you are not talking about topic exchange?
> If I send a message with routing key 'foo' to the exchange, will
> this:
> 1. Transfer the message (over the network) to all nodes and then
> essentially discard it on any nodes that don't have a bound queue
> with routing key 'foo'; or
> 2. Selectively transfer only to nodes that have bound queues listening
> for routing key 'foo'?
2.
Exchanges are just routing table names. They are shared in the cluster, so every
node has an up-to-date list of bindings most of the time (for most systems, saying all the time
is fair). From there it selects a subset of queues that match and a copy is delivered
to master nodes of those queues.
Note that there are no master nodes in general, every queue has a master node and 0 or more mirrors.
--
MK
Staff Software Engineer, Pivotal/RabbitMQ