Closed psulightning closed 1 year ago
Hi @psulightning
For non Rails execution of Shoryuken, If possible, I would rely on ENV variables for Server Config. If that is not possible and you still require a seperation of config and worker code, I would suggest using a require_relative
for the config file. It could look something like this:
# frozen_string_literal: true
# ./shoryuken_config.rb
Shoryuken.configure_server do |config|
# Server configuration here
end
# frozen_string_literal: true
# ./my_super_hard_worker.rb
require_relative "shoryuken_config.rb"
class MySuperHardWorker
include Shoryuken::Worker
shoryuken_options queue: 'default'
def perform(sqs_msgs, events)
# unbreakable code
end
end
Then you should be able to run the executable as normal without needing a Rails initializer.
bundle exec shoryuken -q default -r ./my_super_hard_worker.rb
I thought this pattern as well, but just wanted to confirm. Thank you @matt-taylor .
Looking to use shoryuken in a plain ruby environment and wanted to know the best practices on how to leverage
configure_server
orconfigure_client
since I would not have a Rails initializer. I would rather have separation of concerns for the config not being inside the worker's file.Would I be better off rolling my own script instead of using the built-in
shoryuken
executable?Thanks