Skip to content

Conversation

@jwoodrow
Copy link

Hi 👋

I know this is very very very basic (I'm not event mocking a Bunny::BasicReturn) but I had the need to test my on_return behaviour when publishing messages with a mandatory: true option.

It works as is but:

  • Would be better to emulate Bunny's BasicReturn logic (I couldn't figure out how)
  • Could not find where to add some specs for this

Methods added:

  • on_return(&block) : public method on Bunny::Exchange (exact same implementation as Bunny)
  • handle_return(basic_return, properties, content) : private method on Bunny::Exchange

Methods updated:

  • deliver for Direct, Topic, Fanout (Headers does not work as intended so I haven't changed anything)
    • If opts[:mandatory] is true then deliver will call handle_return to notify that the message could not be delivered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant