Open hading opened 7 years ago
A possible solution (at least for my usage):
Another possibility:
If I get some time I'll see if I can work one of those up and see if it works for me and if so put in a pull request. If not, happy for any sort of solution.
Sorry for reviving and old (but open) issue. Here's how I "solved" the issue:
# Override `BunnyMock::Queue#subscribe` to mimic the default exchange behavior
# of RabbitMQ. Also add the missing opposite `BunnyMock::Queue#cancel`.
module BunnyMock
class Queue
alias original_subscribe subscribe
def subscribe(*args, &block)
channel.default_exchange.add_route(name, self)
original_subscribe(*args, &block)
end
def cancel
channel.default_exchange.remove_route(name, self)
end
end
end
Can I open a PR to include this functionality in BunnyMock?
of course @arnodirlam - make a PR and we can talk about migration
The default exchange should (as I understand - please correct if I'm wrong) route a message to a queue specified by the routing_key even if it is not explicitly bound (ala https://www.rabbitmq.com/tutorials/amqp-concepts.html under "Default Exchange")
So something like:
channel.default_exchange.publish('message', routing_key: 'test_queue', persistent: true)
should always send the message 'message' to the queue 'test_queue', even with no explicit binding, assuming that that queue exists.
This doesn't seem to happen with BunnyMock.