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

Expose retries_count on Racecar::Message #202

Merged
merged 1 commit into from
Dec 9, 2020
Merged

Expose retries_count on Racecar::Message #202

merged 1 commit into from
Dec 9, 2020

Conversation

Alexander-Blair
Copy link
Contributor

In a recent PR, support was added to provide retries_count to the instrumentation payload, in order to define custom behaviours on error handling. However, this does not allow us to drive the consumer's behaviour based on the retries, if required.

Example usage:

  • We're consuming from a topic where we don't absolutely need to process every single update successfully, however we want to allow for a few intermittent failures
class SemiImportantConsumer < Racecar::Consumer
  MAX_RETRIES_COUNT = 5

  subscribes_to "semi_important_topic"

  def process(message)
    data = JSON.parse(message.value)

    do_some_stuff(data)
  rescue StandardError => e
    raise e if message.retries_count < MAX_RETRIES_COUNT

    Honeybadger.notify(e)
    Logger.error("Oh no we ran out of retries")
    ... etc
  end
end

Copy link
Contributor

@dasch dasch left a comment

Choose a reason for hiding this comment

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

Makes sense 👍

@dasch dasch merged commit b3cb7fd into zendesk:master Dec 9, 2020
@Alexander-Blair
Copy link
Contributor Author

Thanks @dasch ! If you are still interested in looking at the concurrent processing (detailed in #188), would be happy to help out where I can

@dasch
Copy link
Contributor

dasch commented Dec 10, 2020

@Alexander-Blair that would be great! Let me know if you'd like some pointers. There's also the ruby-kafka Slack if you'd prefer that.

@dasch
Copy link
Contributor

dasch commented Dec 10, 2020

(or the new, fancy Discussions here on GH!)

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.

2 participants