-
Notifications
You must be signed in to change notification settings - Fork 16
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
Refactor Consumer Module: Introduce JobRunner Trait for Flexible Job Handling #51
Conversation
Codecov ReportAttention:
Additional details and impacted files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally see the need! Left some comments on how to achieve it though.
- removed breaking change: introduced `register_runner` - replaced `E` generic type parameter with asssociated type in `JobRunner` trait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there — just a couple of nits left!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more bit to avoid the box, and then I think we're done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me — thanks for persisting!
Released in 0.12.5 🎉 |
Background
I need to have access to some initialized configuration / state for my Handler.
While I could use
once_cell
to initialize static variables to hold a configuration, it isn't particularly idiomatic.Summary of Changes
This PR introduces a change to the
Consumer
module, converting theJobRunner
type into a trait.The
JobRunner
trait is now implemented for types that can handle jobs, providing more flexibility for handling jobs within aConsumer
.Example Usage
This change is