Closed TimothyMDean closed 8 years ago
Hi @TimothyMDean - thanks for the feedback! I honestly did not know that was how the topic exchanges worked. There were only fanout exchanges in the app that I had written this for originally - and clearly did not read the docs on topic exchanges correctly.
If you could take a look at 2f87036 and let me know if that's the correct implementation that would be awesome. Thanks!
@arempe93 - Your commit looks like the correct implementation to me. I have pulled it into my test code and verified that it works as I would expect it to. Thanks for the quick turnaround on my issue.
No problem
I have code that I'm trying to test that binds to a topic exchange as follows:
The goal here is to handle any messages published to the topic exchange with a routing key of
my-key.insert
,my-key.update
, ormy-key.delete
. This approach is consistent with the topic exchange routing example documented in the Bunny guides.When I try to use bunny-mock to test this code, it does not honor the wildcard in my queue binding and as a result no messages are delivered. Looking at the source code, I see that wildcard replacement is performed on the routing key specified when publishing to a topic exchange (in the
deliver
method ofexchanges/topic.rb
). But there is no wildcard replacement performed on the routing key specified when binding to a topic exchange.Is there a reason why wildcard replacement is only done for the routing key of the published message, rather than for the subscriber's binding? It seems like the more common use case for a pub/sub pattern to have the wildcards applied to the subscriber.