Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

delayed_job_es

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delayed_job_es

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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.

FAQs

Package last updated on 17 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc