On Thu, Jun 19, 2008 at 6:46 PM, Rue Turner <rue at thinlayer.co.uk>
wrote:> Hi,
>
> Did I hear correctly that bgrb has a job queuing engine built in so you can
> inject jobs into a queue and the bgrb pick them up and get on with the
work?
>
> If so can anyone point me at any docs or if not, what solutions are you
using?
>
> thanks
Not exactly how others do, but mechanism is something like this:
class HelloWorker < BackgrounDRb::MetaWorker
set_worker_name :hello_worker
def enque_task args
thread_pool.defer(args) do |block_args|
# do some work here
end
end
end
>From Controller:
MiddleMan.worker(:hello_worker).enque_task(some_data)
So depending upon your thread pool size, that many of tasks will run
concurrently and rest of them will be in queue.