Backgroundrb and tasks

Give me please example
How i can send send email from Backgroundrb worker and
How get access to my modele User

my config


port: “3333”
timer_sleep: 60
load_rails: true
environment: development
rails_env: development
host: localhost
database_yml: config/database.yml
acl:
deny: all
allow: localhost 127.0.0.1
order: deny,allow

my worker

class PsWorker < BackgrounDRb::Rails

repeat_every 2.minutes
first_run Time.now

def do_work(args)
# This method is called in it’s own new thread when you
# call new worker. args is set to :args

logger.debug('DO_WORK '+args.inspect)

Sende1.deliver_test()

end
end

On Thu, 2007-12-20 at 01:36 -0800, bublik wrote:

environment: development
class PsWorker < BackgrounDRb::Rails
end
You are running an old version of backgroundrb, please update your
plugin from here:

http://svn.devjavu.com/backgroundrb/trunk/

Full instructions can be found here:

http://backgroundrb.rubyforge.org/

So your worker with new plugin would look like:

class PsWorker < BackgrounDRb::MetaWorker
set_worker_name :ps_worker

gets called when worker is created

def create(args)
deliver_test_mail()
add_periodic_timer(2*60) { deliver_test_mail }
end

def deliver_test_mail
Sende1.deliver_test
end
end

Inside your workers, you have full access to your rails environment( and
hence model and everything).

For more information, you can join backgroundrb mailing list on:

http://rubyforge.org/mailman/listinfo/backgroundrb-devel


Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org