[rabbitmq-discuss] [Q] fanout exchange same as direct with blank routing key?
Matthew Sackman
matthew at lshift.net
Wed Dec 9 12:14:22 GMT 2009
On Thu, Dec 03, 2009 at 01:01:50PM -0600, Chuck Remes wrote:
> My question is in the subject.
The answer is no. ;)
They are the same only if every binding to the direct exchange uses an
empty binding key, and, as you say, all the publishes are with a
blank routing key.
In many ways, you can think of a direct exchange as a cluster of fanout
exchanges where there is implicitly a fanout for every routing key and
binding key.
> The only difference I can
> think of would be that there might be some matching done against the
> empty string routing key for delivery through the direct exchange that
> is skipped for the fanout exchange. Therefore, a fanout exchange would
> have *slightly* better performance versus a direct exchange with an
> empty routing key.
Correct, and the greater the number of different binding keys the direct
exchange has, the slower it will be. So if performance is important to
you, and you can get away with using a fanout, do so.
Matthew
More information about the rabbitmq-discuss
mailing list