Skip to content

Commit

Permalink
more docs for workers
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed Sep 6, 2008
1 parent 3b1ec1d commit 77d0535
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions doc/content/rails/rails.txt
Expand Up @@ -79,6 +79,25 @@ rails using:

You can as usual use @worker_key@ if *worker was started with a worker_key*.

p(sub-title). Enqueue task to the persistent job queue :

Jobs executed via synchronous and asynchronous APIs are fine, but these tasks are usually
kept in memory(and hence they are fast) and hence aren't entirely failsafe.

To solve this _BackgrounDRb_ also lets you add jobs to a persistent job queue, which is
automatically picked by responsible worker and invoked. To use this:

<pre class="boxed">MiddleMan(:hello_worker).enq_some_task(:arg => "hello_world",:job_key => "boy")</pre>

With _BackgrounDRb_ version >= 1.1, you can also schedule a persistent task to be executed at a particular time,

<pre class="multiline">MiddleMan(:hello_worker).enq_some_task(:arg => "hello_world",
:job_key => "boy",:scheduled_at => (Time.now + 1.hour))</pre>

Above line will add specified task to the job queue and set to be invoked at specified time. For more information
about scheduling see scheduling section.


p(sub-title). Start a Worker :

To start a worker from rails:
Expand Down
1 change: 1 addition & 0 deletions doc/content/workers/workers.txt
Expand Up @@ -154,6 +154,7 @@ class HelloWorker
end
end</pre>


%(entry-title)<a href="testing">Testing Workers </a>%

_BackgrounDRb_ comes with a baked in mechanism to write test cases. First make sure that you
Expand Down

0 comments on commit 77d0535

Please sign in to comment.