How to use callbacks with beanstalkc and beanstalkd

142 views Asked by At

I want to use call back went I put job in queue, when the job is reserve and when it's delete. How can I do this?

This is my code in PHP:

$queue->put(array('contracts' => $stateContract.$id_contract));

And this is in Python:

beanstalk.watch('contracts')
stateTube = beanstalk.stats_tube('contracts')

while stateTube.get('current-jobs-ready') != 0:

    #--> keep jos if it isn't "reserve"
    job = beanstalk.peek_ready()
    job = beanstalk.reserve()
    message = job.body

    stateTube = beanstalk.stats_tube('contracts')

    # --> delete job
    job.delete()
0

There are 0 answers