[Backgroundrb-devel] getting started

Tim Glen tim at pivotib.com
Fri Jan 11 16:19:46 EST 2008


Hey all,

Been reading through all the old posts (and the docs) to familiarize  
myself but I still feel a bit lost.

I'm on trunk and am having a bit of a hard time knowing where to start  
with the particular I'm trying to solve.

So far, I've downloaded backgroundrb, done the basic rails setup,  
created my worker and started it using `script/backgroundrb start`.  
Here's the behaviour I'm looking to create:
1. When a file is uploaded, the worker needs to be triggered to start  
processing the file (this is a 20-60 minute job, depending on the file)
2. The user should be redirected to a page where they can see a status  
of the processing job (the ideal would be a percentage or status bar  
but I realize that's an implementation concern). most importantly,  
they need to know when it's been completed.

Here are my questions - since this only needs to take place every  
month or so, I don't really feel like I need a long-running worker  
necessarily. From the docs, it seemed like I could call:
MiddleMan.ask_work(:worker => :sales_processor, :worker_method  
=> :do_work, :data => @upload.id)
In the :do_work method, I'm calling register_status but am receiving  
nil when I call ask_status

I guess I just feel like I'm shooting in the dark here - not sure if  
i'm going in the right direction at all. Should I be using ask_work  
with register_status? Perhaps send_request (though I don't want the  
http request to wait for the worker to be completed)? Does the worker  
need to be running on a schedule before I can use either of these?

I would appreciate any direction.

thanks,
tim


More information about the Backgroundrb-devel mailing list