Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add another maxretry handler which does not create additional exchanges #205

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nevesenin
Copy link

No description provided.

@nevesenin nevesenin mentioned this pull request Feb 18, 2016
@Spaceghost
Copy link

I bet to get this merged, it'll be helpful to convert from rspec back into minitest like. If you'd like some help with this, I could either pair with you on it or I might be able to take a look and try to convert it myself. If you're not merged in by then, I'll pull request to your branch.

@nevesenin
Copy link
Author

Hi, I don't have much experience with minitest. To be honest, I don't know what you mean.

channel.reject(delivery_info.delivery_tag)
end

def error_payload(delivery_info, message_properties, payload, reason, num_attempts)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nevesenin
Could you explain why we need to change original payload?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add debug information in case of an error.

@JanStevens
Copy link
Contributor

Cool, how does this differ in terms of the existing max retry exchange?
It does not create extra exchanges but does this have a performance penalty? Any change you can draw some topology out?

thanks looks interesting!

@JanStevens
Copy link
Contributor

JanStevens commented Jun 2, 2016

After some experimenting a couple of pointers for other people that want to try:

when making a worker you must add the following arguments:

class Worker
    from_queue :foo, handler: Sneakers::Handlers::RoutingMaxretry,
      arguments: { 
        'x-dead-letter-exchange' => "exchange", 
        'x-dead-letter-routing-key' => "queue.foo.retry" 
      }
    # ...
end

Notice that its .retry and not -retry as with the current maxretry handler

Next, wildcard route matching is quite dangerous. I had a general routing key from my exchange to foo using # but this creates an endless feedback loop. If any of your defined routing_keys also match the following then you might have problems (I'm using example queue name foo):

  • queue.foo.error
  • queue.foo.requeue
  • queue.foo.retry

@TheBerg
Copy link

TheBerg commented Oct 18, 2016

I am working on using this, but when an error goes to the error queue bunny errors and gives me a IOError: not opened for reading error. I am investigating but just thought I would post here if anyone has got an idea. :)

@TheBerg
Copy link

TheBerg commented Oct 18, 2016

It was something with how error_payload was generated. Since I want the original payload then overriding this method to just return payload fixed it for me.

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.

5 participants