Firstly, my knowledge of PHP is limited on threading, and secondly it seems PHP don't have sophisicated threading APIs like Java or dotNET.
So I came up with a solution that makes multiple SOAP calls to the remote server, but not using threads.
In processing the data, the table has a row id. Simply decide how many concurrent processes you want, and pick out the data to process by the modulus. e.g. if you want to have 2 concurrent processes to send out SOAP messages, pick out the data as such
where id%2=0
and
where id%2=1
Two cron jobs are created, one to call each script with the different parameter (of course, we can do this via a bash script so only one cron job is created).
So there, no race-conditions, no hung threads (ok, maybe hung process), and no headaches.
No comments:
Post a Comment