2

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()
wxcvbn
  • 483
  • 2
  • 7
  • 20
  • I can't figure out what do you want, please detail it. – Pentium10 Aug 18 '16 at 19:18
  • @Pentium10, I want to be able to say if and when a job has been send or if job has been delete – wxcvbn Aug 19 '16 at 11:46
  • say where, in PHP part? – Pentium10 Aug 19 '16 at 11:52
  • @Pentium10, what do you mean ? – wxcvbn Aug 19 '16 at 12:05
  • As I understand you have two sections of your code, one web app in PHP that renders HTML and one console app in Python that is the worker. Please explain better what you want, as we cannot guess. – Pentium10 Aug 19 '16 at 12:13
  • @Pentium10, I have two programme, one in php and one in Python. Both of them are execute by commande line. First in Php code I connect me on beanstalkd server to put a job in "contract" tube. Second, I execute the python script which keep job in beanstalkc server in "contracts" tube do treatment, and at the end delete job.I want to have a history of job, to know if it has been send correctly, if it was correctly receiving etc... I want to kwon if my server crash which job are stop, and where. – wxcvbn Aug 19 '16 at 12:45
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/121351/discussion-between-wxcvbn-and-pentium10). – wxcvbn Aug 19 '16 at 12:46

0 Answers0