我想使用回调去我把工作放在队列中,当工作被保留和被删除时。我怎样才能做到这一点?
这是我在 PHP 中的代码:
$queue->put(array('contracts' => $stateContract.$id_contract));
这是在 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()