Simple Queue Add-On With Workers


Seeing as a lot of people these days seem to be relying on cronjobs, I went ahead and wrote a worker implementation for CsCart. I have been using it the past few years and it works really well, especially for e.g. sending mail asynchronously, processing images, synchronizing product changes, etc.

Feel free to add functionality where needed.

Kind regards,

I am currently reworking a part of this to be more robust (with failed job loggin). I am also checking whether there is a way for me to re-initialize the store context in some way, or whether I need to kill the worker after each job executed to reduce context leaking.

Nice, thanks.


The worker add-on has been revised to log jobs to a table. There is also now a Laravel-like interface for creating the jobs (which should allow for an easier migration to Laravel if you intend on using them) with proper rescheduling support if the jobs has failed. The add-on will be released to the marketplace in the near future (awaiting cscart's approval and the release of v4.15)

Most notably, there is also now an example add-on for queueing mails through jobs. So for those who are looking for a free alternative to might want to take a look.

Do mind that the new CsCart V4.15 version is required (to be released), which includes a few modifications that were needed, such as but not limited too:

1. Transaction interface with automatic rollback / commit. You can now use `db_transaction(Closure $f);` to start and commit a transaction. This was needed for row-level locking, to avoid concurrency issues (you can now have more than 1 worker reliably).

2. FQCN's now have priority over `is_callable`, meaning that you can now register everything from HookHandlers to other dependencies using the FQCN (

For 4.16 there might be Autowiring, although this is still to be discussed.