Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

ror
ruby on rails

How to set the backend in ROR

Behzad Ahmad

In Ruby on Rails (ROR), an external library backend must be integrated in order to execute a job.

ROR has multiple built-in queuing adapters for the backend, such as Resque, Sidekiq, Delayed Job, etc.

Set the backend

We can easily set the backend of the application, as demonstrated below. After this, all jobs that require the backend will interact with the one specified here.

# config/app.rb
module Name
  class App < Rails::App
    
    config.active_job.queue_adapter = :sidekiq
  end
end

We can also set the backend as per each job that overrides the backend of the entire application set for that particular job. We can perform this operation as follows:

class GuestsCleanupJob < ApplicationJob
  self.queue_adapter = :resque
  # ...
end

RELATED TAGS

ror
ruby on rails

CONTRIBUTOR

Behzad Ahmad
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring