Background Job Queue

Learn how to configure Long-processing tasks for X-Cart.

Olga Tereshina avatar
Written by Olga Tereshina
Updated over a week ago

Starting from the 5.3.3 version, X-Cart can perform some long-processing tasks (such as email sending and image resizing) asynchronously, increasing the UI responsiveness and speeding up the store operations.

Please note that this feature is experimental and may be unstable.

As of now, the background jobs queue speeds up the following actions:

  • Order operations (placing, changing shipping and payment statuses, updating via AOM);

  • Any other actions which involve an email sending;

  • Amazon S3 image transfer.

You can enable the job queueing by setting the following config option in the etc/config.php file:

[queue] backgroundJobsSchedulingEnabled = true

After this, X-Cart will push every job to the message queue instead of executing on the stop. There are several ways of executing jobs placed on this queue:

  • Cron Task

    If you have configured your server to run scheduled X-Cart tasks, X-Cart will process the job queue at the next cron run. Therefore, we advise scheduling cron tasks for the shortest period possible, e.g., 5 - 10 minutes.

  • Console Application

    In case you to control the queue processing via an external script, you can start queue processing by running the following command in the X-Cart working dir:

    php console.php --target=consumer --action=consumeAll

  • Browser Execution

    You can also control and process pending jobs via the X-Cart Admin area page - admin.php?target=jobs. To be able to run this page, your X-Cart config should have the following option under the [queue] section:

    jsRunnerForOnlineEnabled = true

This option is enabled by default in X-Cart 5.3.3.

Did this answer your question?