- Start rails server:
rails s
- Start sidekiq:
sidekiq
- Go to
http://localhost:3000
- Click on "Do Sync Job" link to run the generic logging task synchronously.
- Click on "Do Async Job" link to run the same generic logging task asynchronously via Sidekiq.
- Ideally, the
Rails.logger.warn
statements from the generic logging task would appear in the same places, regardless of whether they are run sychronously or async via Sidekiq.
- Rails server terminal console window shows logging statements.
development.log
file shows logging statements.
- Sidekiq terminal console window does NOT show logging statements.
development.log
file shows logging statements.
- app/models/generic_task.rb ==> This is the PORO object with the
Rails.logger.warn
statements. - app/jobs/logging_job.rb ==> Sidekiq job class the just runs the GenericTask above.
- app/controllers/home_controller.rb ==> Simple controller to run the GenericTask either sychronously or async via Sidekiq.