arempe93 / bunny-mock

A mock client for RabbitMQ modeled after the Bunny client in ruby
http://www.rubydoc.info/github/arempe93/bunny-mock
MIT License
44 stars 37 forks source link

Channel#basic_publish and publisher confirms #11

Closed podung closed 8 years ago

podung commented 8 years ago

Are you open to PRs for new functionality?

If so, what are your thoughts on Bunny::Channel#basic_publish? The mock channel could look through its @exchanges collection for a matching exchange and just call publish, passing down the payload and route key.

Publisher confirms might be more involved, but I don't suspect it would be all that difficult. There would need to be an api to declare that when a message gets published that it should fail to be acked from the server:

connection = MockBunny.new.start
channel = connection.create_channel
exchange = channel.direct(:some_exchange)

expect(exchange).to receive(:publish).with(some_data).and_nack

exchange.publish(some_data)

expect(channel.wait_for_confirms).to eq false
expect(channel.nacked_items.count).to be 1
arempe93 commented 8 years ago

I'm open to any PR to add features from Bunny. Go ahead and give this feature a shot if you'd like!

podung commented 8 years ago

Please check out PR #12 and let me know what you think.

I'll add the publisher confirms in another PR after I think about it a bit more.

podung commented 8 years ago

Merged in #12

podung commented 8 years ago

I'll open new issue for publisher confirms to track that