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

Publisher confirms #14

Open podung opened 8 years ago

podung commented 8 years ago

Split out from issue #11

I would like to see publisher confirms added to the library, to support the acks/nacks from the server when putting an item on the queue. There would need to be an api to configure that certain messages 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

I'll work on a PR soon. Any thoughts on the API or how it should work for exchanges vs queues would be great.

baelter commented 8 years ago

Added stub for wait_for_confirms in https://github.com/arempe93/bunny-mock/pull/20