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

queue_dispatcher

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queue_dispatcher

  • 2.5.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= QueueDispatcher for Rails3

{}[https://codeclimate.com/github/InWork/queue_dispatcher]

This Rails3 Gem implements a method to perform long running methods in the background. Background tasks will be executed by persistent workers.

== Install

Inside your Gemfile: gem "queue_dispatcher"

and then run: bundle install

To install the queue_worker_dispatcher script, which starts all workers, execute the following rake command: rake queue_dispatcher:sync

=== Database Setup

Use rails g queue_dispatcher:migration

This will create a database migration for the models Task and TaskQueues.

If you update the queue_dispatcher from pre 1.5.1 you have to use the following command to update your migrations:

Use rails g queue_dispatcher:migration --skip

This will create all new database migrations for the models Task and TaskQueues and leve the existing as they are.

=== Gem Dependencies

Please check if all those requirements are satisfied on your environment.

  • rails >= 3.0.0
  • sys-proctable >= 0.9.1

== Inside your application

To enqueue a long running task, simple call a method through enque. E.g.: Assume, you have a long running job: LongRunningMailJob.send_mail

Now we'd like to execute it in the background by simply calling: task = LongRunningMailJob.enqueue.send_mail

If you like to put the job in a queue, you can do this by execute it the following way: task = LongRunningMailJob.enqueue(queue: 'queue_name').send_mail

Jobs inside a queue are executed serialized, not in parallel. You can define dependencies. A task is then executed only after all dependent tasks are finished. The dependencies could also be in another queue. This way you could ensure, that a task is only executed when another task from another queue is successfully finished. Code to add Task dependencies: task.dependent_tasks = another_task

=== Queue Worker Dispatcher The QueueWorkerDispatcher-script starts the workers (default are 10 workers). A worker waits for a new queue and executes all tasks of this queue. Start the QueueWorkerDispatcher by executing the following command: script/queue_worker_dispatcher

To start the QueueWorkerDispatcher as a daemon, use the option -b. -b, --background work in background mode

== License This project is licenced under the MIT license.

== Author Philip Kurmann (philip (at) kman.ch)

FAQs

Package last updated on 20 Aug 2015

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