Sha256: ede58c2aa485bb73f2c5764d57f87d1ec493a07668e0e63f982aab3d3cb9781d

Contents?: true

Size: 1.95 KB

Versions: 17

Compression:

Stored size: 1.95 KB

Contents

= QueueDispatcher for Rails3

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.

=== 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

== Copyright

Copyright (c) 2011 - 2012 Philip Kurmann. See LICENSE for details.

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
queue_dispatcher-1.1.19 README.rdoc
queue_dispatcher-1.1.18 README.rdoc
queue_dispatcher-1.1.17 README.rdoc
queue_dispatcher-1.1.16 README.rdoc
queue_dispatcher-1.1.15 README.rdoc
queue_dispatcher-1.1.14 README.rdoc
queue_dispatcher-1.1.12 README.rdoc
queue_dispatcher-1.1.11 README.rdoc
queue_dispatcher-1.1.10 README.rdoc
queue_dispatcher-1.1.9 README.rdoc
queue_dispatcher-1.1.8 README.rdoc
queue_dispatcher-1.1.7 README.rdoc
queue_dispatcher-1.1.6 README.rdoc
queue_dispatcher-1.1.5 README.rdoc
queue_dispatcher-1.1.4 README.rdoc
queue_dispatcher-1.1.3 README.rdoc
queue_dispatcher-1.1.2 README.rdoc