[Backgroundrb-devel] Get a unique job id back when enqueing a task

Max Williams toastkid.williams at gmail.com
Thu Nov 20 09:24:52 EST 2008

Thanks Hemant.  My problem is though that i need to know a unique id for a
job before it is picked up by a worker (so i can start tracking it).

What would be perfect is to get the id of the job queue record: at the
moment that's what i'm doing but in quite a clumsy way.  Is there a way to
just get the actual BdrbJobQueue object back?


2008/11/20 hemant <gethemant at gmail.com>

> Yes!
> You can use job_key method in your worker to retrieve the job key of
> current task. Its a thread local variable and hence thread safe, can
> be also used inside threads without problems.
> You can also use persistent_job method inside your worker to retrieve
> currently executed task.
> On Thu, Nov 20, 2008 at 3:59 PM, Max Williams
> <toastkid.williams at gmail.com> wrote:
> > This is a simple question, but i can't find the answer on the internets.
>  Is
> > there a way, when putting a job into the job queue, to get back an object
> > for the BdrbJobQueue record that is created?  (or at least its id)
> >
> > I need to pass a simple id around my app that will always relate to a
> > specific job.  At the moment i'm doing this by making a unique job key
> > string and using that to create and track the job, but it's a clumsy
> > approach and i'd rather just use the id from the db table, which i would
> > pull from the new job object.  Assuming i can get it back.
> >
> > Thanks for the help, bdrbheads.  ;-)
> >
> >
> >
> > _______________________________________________
> > Backgroundrb-devel mailing list
> > Backgroundrb-devel at rubyforge.org
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20081120/c9317167/attachment-0001.html>

More information about the Backgroundrb-devel mailing list