Mike Clymer
2008-Sep-10 17:34 UTC
[Backgroundrb-devel] async_some_task vs new_worker & deleting a unique worker
Hi All, I am using custom data collection agents to periodically poll a given data source on the internet, for a given user of our application. I would like to create a backgroundrb worker, per type of data source, per user, to kick off the associated data collection agent in it''s own background process. I have looked at the docs and I am wondering if using MiddleMan.new_worker would suffice. I could have the worker''s "create" method kick off the data collection agent. Is there some additional benefit to moving the agent creation logic to the "async_some_task" worker functionality instead? I would like each worker and associated agent to run in their own process / thread to unload the burden from the Rails application. On a related note, I also need to kill the data collection agent when the user is no longer interested in collecting data from a particular source. I plan to create the worker with a unique worker_key. Will using that worker_key along with the worker name / type in the delete method only kill the worker of that name associated with the given key? I need workers of the same type with different keys to keep processing. By killing the worker, will the data collection agent created by that worker also be destroyed? I hope my questions are clear enough. I greatly appreciate any help. --Mike