ruby-shoryuken / shoryuken

A super efficient Amazon SQS thread based message processor for Ruby. This project is in MAINTENANCE MODE. Reach me out on Slack link on the description if you want to become a new maintainer.
Other
2.06k stars 280 forks source link

Not able to extend polling strategy when using yaml syntax for configuration. #760

Closed agrajgarg1526 closed 9 months ago

agrajgarg1526 commented 10 months ago

Encountered an issue while extending the polling strategy via YAML configuration syntax, resulting in the error message:"#{strategy} is not a valid polling_strategy", as defined in the codebase here.

We can define the strategy using polling_strategy: ExtendedStrategy in the YAML file. The issue arises from passing a string here, but the polling_strategy function is expecting a Class instead(if not WeightedRoundRobin or StrictPriority). This mismatch prevents any of the cases from being computed, leading to the raised exception.

Raised https://github.com/ruby-shoryuken/shoryuken/pull/759 to address this. The proposed fix involves adjusting the code to expect a String, not a Class, in the last switch case. It then returns the corresponding class by using Object.const_get(strategy).