I need a simple table that acts as a Queue. My MySQL server restriction is I can\'t use InnoDB tables, only MyISAM.
Clients/workers will work at the same time and they w
Oleg,
The solution is correct. $consumer_id
must be a unique identifier for the processor. If you had a couple cron jobs on one machine, for example, you could use their pid
as the consumer ID
.
The UPDATE is atomic, so it marks exactly one row in the queue as being consumed by your ID
.
For some applications I also have a status field for finished, so that if last_pop's consumer_id
is set, but the finished flag is not set and the job is older than X, it can be marked to be restarted.