1

So we will have a topic exchange that looks something like

{class}.{genus}

So we have some consumers that bind with the topic

mammal.*

(or bird.*, etc.)

Now suppose later on we want to include species information so the topic exchange now looks like this:

{class}.{genus}.{species}

Now the old consumers are broken :(

However they could have bound as

mammal.*.#

And been able to listen to whatever future information is added. However, this is something my team came up with on our own which leads me to ask:

  • Is this good practice?
  • Are there tradeoffs to this I should be aware of?
  • Is there an alternate way to have a producer be able to add information without breaking existing consumers, without publishing to multiple exchanges?

1 Answer 1

0

Typically if you have a need maximum control on queue delivery and want to do the logic in rabbit, then you should consider header exchanges.

Usually when we code up the publish we know exactly which queue it needs to go to, so whether you want to use a routing key or a boolean to do this might not make much difference depending on your application.

This brings up another design consideration to be aware of: whether you want routing logic in rabbit. Someone people prefer to just use simple routing keys and either direct or topic exchanges, focusing on flexible consumers. Its going to be hard to guess at what is best for your application obviously.

Keep in mind that your consumers will be subscribed, often statically, to the queue(s) that the exchange delivers to. Also mammal.# is the same as mammal.*.# (see: ref)

1
  • 1
    RabbitMQ In Action de facto states that header exchanges are deprecated and topic should be used - do you agree with this or are there any difficulties with header I should be aware of?
    – djechlin
    Mar 7, 2013 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.