Michael Siebert
2006-Jul-31  20:17 UTC
[Backgroundrb-devel] [PATCH-SUGGESTION] autostarting workers
Hi there,
as i stated before in my talk with Ben Johnson, I hacked a little bit and
here it is - autostarting jobs. I think someone (eh... Ezra) should review
it and check to see if i made any mistakes. Also i dont have the possibility
to test it on other-than-Windows systems, but since the calling process
works just the same, it should do well...
Now the neccesary evil, the documentation...
If you want a worker to start when BackgrounDRb start, you just have to add
a few lines to your backgroundrb.yml file:
[.. your config...]
autostart:
  job_key:
    class: foo_worker
    args: bar
args can be everything YAML allows. Since the backgroundrb.yml file is
parsed by ERb _before_ YAML, conditional autostart is possible, just like in
your rhtml templates. But keep in mind that the Rails environment is loaded
_after_ the config file is parsed, so you won''t have access to your
Models!
Don''t forget: Have fun!
-- 
Michael Siebert <info at siebert-wd.de>
www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060731/57020de6/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autostart.patch
Type: application/octet-stream
Size: 7066 bytes
Desc: not available
Url :
http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060731/57020de6/attachment-0001.obj