0.0
No release in over 3 years
Low commit activity in last 3 years
Elastic Search backend for Delayed Job, only using the ES transport client and the Es-ruby api as dependencies.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 5.0
~> 10.0

Runtime

 Project Readme

DelayedJobEs

Delayed Job Backend adapter for ElasticSearch.

The gem uses the 'elasticsearch-transport' and 'elasticsearch-api' as dependencies.

It has no other dependencies, and should be easy to integrate into any ruby based project that uses elasticsearch in any form.

Installation

Add this line to your application's Gemfile:

gem 'delayed_job_es'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install delayed_job_es

Usage

Job Class

Create a Job Class in the app/jobs folder :

  	class BackgroundJob < ActiveJob::Base
  
  		queue_as :default

  		## Specify the queue adapter as delayed_job_es
  		self.queue_adapter = :delayed_job

  		self.logger = Logger.new(nil) if Rails.env.test? 

	  	rescue_from(StandardError) do |exception|
	  		puts exception.message
	   		puts exception.backtrace.join("\n")
	  	end
  
  		def perform(args)
  			## process job here.
  		end

  	end

Es Indexes

Create required ES Indexes:

# in the rails console, (you only need to do this once)
DelayedJob::Backend::Es::Job.create_indices

Job Daemon

Open a terminal window, navigate to your project and run :

$ bundle exec rake jobs:work

This will run a job daemon(standard DelayedJob).

Queue a Job

To queue a job, from anywhere using the job class above run (you can try this in the rails console, in another window):

BackgroundJob.perform_later({"hello" => "world"})

If you look in the jobs daemon window, you will see the job getting processed.

Development

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/delayed_job_es. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the DelayedJobEs project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.