mugoweb / mugo_queue
Queue system for ezpublish
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 3
Open Issues: 0
Type:ezpublish-legacy-extension
Requires
This package is auto-updated.
Last update: 2024-11-27 14:03:13 UTC
README
What is it?
It's a framework to handle a queue of tasks.
An example: You'd like to rebuild the eZ Find search index for all Article objects. To re-index all articles, you add multiple tasks into the queue. With this framework, you can also develop a task that can re-index a single article. Another process would fetch "re-index" tasks from the queue, execute them, and then remove them if the execution was successful.
The framework comes with a script to add tasks to the queue or to execute tasks from the queue. The task is an abstract class. To implement a concrete task, you need to implement 2 methods:
-
function create( $parameters ): The function has to create an array of task ids. With regard to the example, that function would return an array of all article object ids.
-
function execute( $task_id, $parameters ): Executes on single task id. With regard to the example, that function would a fetch the object for the given $task_id and add it to the search index
Install instructions
-
extract the archive into the extension folder
-
enable the extension -- for example in settings/override/site.ini.append.php
Add this line: ActiveExtensions[]=mugo_queue
under the block '[ExtensionSettings]'
-
Import DB schema: mysql -u YourUser -pYourPass YourDB < sql/mysql/schema.sql
-
re-generate autoloads: php bin/php/ezpgenerateautoloads.php -e
-
try to execute the script: php extension/mugo_queue/bin/run.php
What's the difference between Mugo Queue and an eZ Publish script or cronjob?
The end result is the same: a simple eZ Publish script can rebuild the eZ Find search index for all Article objects - and so can Mugo Queue.
Mugo Queue requires you to divide the process into 2 steps:
- adding the tasks to the queue
- executing tasks from the queue
You can interupt a normal script at any time and restart it from scratch. With Mugo Queue you have the option to continue at the point where you interrupted the script (with remaining tasks in the queue).
You'd need to learn how to write a task class but you don't have to learn how to implement a complete eZ Publish script or cronjob.
Mugo Queue supports multiple threads to process tasks from the queue.
Because of the 2 step process, you can collect tasks during the day and execute the tasks at night (or at other low traffic times).
The Mugo Queue framework enables you to execute tasks not only from the command line context but also in the context of a normal Apache request.