PHPackages                             oat-sa/extension-tao-task-queue - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. oat-sa/extension-tao-task-queue

ActiveTao-extension[Queues &amp; Workers](/categories/queues)

oat-sa/extension-tao-task-queue
===============================

TAO specific Task Queue with custom GUI

v6.10.0(2mo ago)264.2k↑75%1[3 PRs](https://github.com/oat-sa/extension-tao-task-queue/pulls)2GPL-2.0-onlyPHPCI passing

Since Oct 13Pushed 1mo ago42 watchersCompare

[ Source](https://github.com/oat-sa/extension-tao-task-queue)[ Packagist](https://packagist.org/packages/oat-sa/extension-tao-task-queue)[ Docs](http://www.taotesting.com)[ RSS](/packages/oat-sa-extension-tao-task-queue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (119)Used By (2)

Distributed Task Queue
======================

[](#distributed-task-queue)

[![codecov](https://camo.githubusercontent.com/404dacd837a3a10c94db4f2a7520ef04db2cf43ce685f9bf33efd57e3ddddd16/68747470733a2f2f636f6465636f762e696f2f67682f6f61742d73612f657874656e73696f6e2d74616f2d7461736b2d71756575652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/oat-sa/extension-tao-task-queue)

> This article describes the functioning of an ASYNC Task Queue.

Install
-------

[](#install)

You can add the Task Queue as a standard TAO extension to your current TAO instance.

```
 $ composer require oat-sa/extension-tao-task-queue
```

### Queue component

[](#queue-component)

Queue can work with different types of queue brokers, here two types are to accomplish ASYNC mechanism:

- **RdsQueueBroker** which stores tasks in RDS.
- **SqsQueueBroker** which is for using AWS SQS.

*Note*:

> When SqsQueueBroker is used, please make sure that "**oat-sa/lib-generis-aws**" is included in the main composer.json and you have generis/awsClient.conf.php properly configured.

#### Weight

[](#weight)

A Queue can have a weight. If multiple Queues are in use, this weight will be used for randomly select a Queue to be consumed. For example, if QueueA has weight of 1 and QueueB has weight of 2, then QueueB has about a 66% chance of being selected.

### Worker component

[](#worker-component)

Here we have a so called `LongRunningWorker` which can run unlimited time. It has built-in signal handling for the following actions:

- Shutting down the worker gracefully: SIGTERM/SIGINT/SIGQUIT
- Pausing task processing: SIGUSR2
- Resuming task processing: SIGCONT

*Note*:

> Multiple workers can be run at the same time.

After processing the given task, the worker saves the generated report for the task through the Task Log.

Service setup examples
----------------------

[](#service-setup-examples)

### Multiple Queues settings

[](#multiple-queues-settings)

In this case we have 3 Queues registered: one of them is using SQS broker, the other two RDS. Every Queue has its own weight (like 90, 30, 10) which will be used at selecting the next queue to be consumed.

And we have two tasks linked to different queues, furthermore the default queue is specified ('background') what will be used for every other tasks not defined in OPTION\_TASK\_TO\_QUEUE\_ASSOCIATIONS.

```
use oat\tao\model\taskQueue\QueueDispatcher;
use oat\tao\model\taskQueue\Queue;
use oat\taoTaskQueue\model\QueueBroker\RdsQueueBroker;
use oat\taoTaskQueue\model\QueueBroker\SqsQueueBroker;
use oat\tao\model\taskQueue\TaskLogInterface;
use oat\tao\model\taskQueue\QueueDispatcherInterface;

$queueService = new QueueDispatcher(array(
    QueueDispatcherInterface::OPTION_QUEUES => [
        new Queue('priority', new SqsQueueBroker('default', \common_cache_Cache::SERVICE_ID, 10), 90),
        new Queue('standard', new RdsQueueBroker('default', 5), 30),
        new Queue('background', new RdsQueueBroker('default', 5), 10)
    ],
    QueueDispatcherInterface::OPTION_TASK_LOG     => TaskLogInterface::SERVICE_ID,
    QueueDispatcherInterface::OPTION_TASK_TO_QUEUE_ASSOCIATIONS => [
        SomeImportantAction::class => 'priority',
        SomeLessImportantTask::class => 'standard'
    ]
));

$queueService->setOption(QueueDispatcherInterface::OPTION_DEFAULT_QUEUE, 'background');

$this->getServiceManager()->register(QueueDispatcherInterface::SERVICE_ID, $queueService);
```

If the queue has not been initialized, meaning the required queue container has not been created yet:

```
try {
    $queueService->initialize();
} catch (\Exception $e) {
    return \oat\oatbox\reporting\Report::createError('Initializing queues failed');
}
```

### Initializing the queues and the task log container

[](#initializing-the-queues-and-the-task-log-container)

You can run this script if you want to be sure that the required queues and the task log container are created.

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\InitializeQueue'
```

*Note*:

> This script also can be used to change the current queues to use a different queue broker.

- Changing every existing queue to use InMemoryQueueBroker. (Sync Queue)

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\InitializeQueue' --broker=memory
```

- Changing every existing queue to use RdsQueueBroker. Option "persistence" is required, "receive" (Maximum amount of tasks that can be received when polling the queue) is optional.

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\InitializeQueue' --broker=rds --persistence=default --receive=10
```

- Changing every existing queue to use SqsQueueBroker. Option "aws-profile" is required, "receive" is optional.

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\InitializeQueue' --broker=sqs --aws-profile=default --receive=10
```

- If you want to apply the settings above for a specific queue, you can add `--queue=...` option to the command. In the following case, only `myQueue` will be modified.

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\InitializeQueue' --queue=myQueue --broker=rds --persistence=default --receive=10
```

- Setting a task selector strategy.

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\InitializeQueue' --strategy="\oat\taoTaskQueue\model\TaskSelector\StrictPriorityStrategy"
```

### Running a worker

[](#running-a-worker)

To run a worker, use the following command. It will start a worker for running infinitely and iterating over every registered Queues based in their weights.

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\RunWorker'
```

If you want the worker running for a dedicated Queue, pass the name of the queue to the command like this:

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\RunWorker' --queue=priority
```

You can limit the iteration of the worker. It can be used only on a dedicated queue.

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\RunWorker' --queue=standard --limit=5
```

If you want to associate specyfic task to new queue you can use this command:

```
 $ sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\ManageAssociationMap' \
      -t  '{ you fully qualified task class name }' -q queue-name
```

Next time when defined task will be created, it will be assign to specified queue.

### Summarize stuck tasks

[](#summarize-stuck-tasks)

Execute this command if you want to summarize stuck tasks. Example:

```
sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\StuckTaskSummary' \
--queue indexation_queue \
--age 300 \
--whitelist "oat\tao\model\search\tasks\UpdateResourceInIndex,oat\tao\model\search\tasks\UpdateClassInIndex"
```

### Restart stuck tasks

[](#restart-stuck-tasks)

Execute this command if you want to restart stuck tasks. Example:

```
sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\StuckTaskRestart' \
--queue indexation_queue \
--age 300 \
--whitelist "oat\tao\model\search\tasks\UpdateResourceInIndex,oat\tao\model\search\tasks\UpdateClassInIndex"
```

Rest API
--------

[](#rest-api)

The task log reports can be viewed/consume using the Application Programming Interface (API). In order to use it please check the swagger file in (doc/taskApi.yml).

Command Line Utility
--------------------

[](#command-line-utility)

Besides using the API to check reports of tasks, another way it's using the command line.

```
sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\TaskLogUtility' --help
```

This command will show you all the possibilities action the the utility can have.

```
Examples
 1. Stats
	 Description: 	 Return stats about the tasks logs statuses
	 Example: 	 sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\TaskLogUtility' --stats
 2. List Task Logs
	 Description: 	 List All the tasks that are not archived will be retrived, default limit is 20
	 Example: 	 sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\TaskLogUtility' --available --limit[optional]=20 --offset[optional]=10
 3. Get Task Log
	 Description: 	 Get an specific task log by id
	 Example: 	 sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\TaskLogUtility' --get-task=[taskdId]
 4. Archive a Task Log
	 Description: 	 Archive a task log
	 Example: 	 sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\TaskLogUtility' --archive=[taskdId] --force[optional]
 5. Cancel a Task Log
	 Description: 	 Cancel a task log
	 Example: 	 sudo -u www-data php index.php 'oat\taoTaskQueue\scripts\tools\TaskLogUtility' --cancel=[taskdId] --force[optional]

```

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance87

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community34

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~20 days

Total

81

Last Release

82d ago

Major Versions

v2.2.0 → v3.1.02019-05-24

v3.3.1 → v4.0.02019-08-30

v4.0.0 → v5.0.02019-10-11

v3.3.1.1 → v6.0.02021-02-18

v5.4.1.1 → v6.5.02021-07-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/98ddc6f1b615b1fac2d59f1e72d5dc6056cf6650414271da90cb3f0e203516fe?d=identicon)[bugalood](/maintainers/bugalood)

![](https://www.gravatar.com/avatar/c0ec704e0a8abaf0c27b227ad05d7aca23bc8f83d195229d94d4508cddc0fd24?d=identicon)[oat-lionel](/maintainers/oat-lionel)

![](https://www.gravatar.com/avatar/e8c30644c0da147701176483ca1ca40e1c41012e6c5b0da47e984c1eb8a840b1?d=identicon)[jbout](/maintainers/jbout)

![](https://www.gravatar.com/avatar/348b2cf6408227372fbb22c6e8b0832e1c8c98c5d6b0c88bb220dbdfbcd21a39?d=identicon)[krampstudio](/maintainers/krampstudio)

---

Top Contributors

[![ssipasseuth](https://avatars.githubusercontent.com/u/8425344?v=4)](https://github.com/ssipasseuth "ssipasseuth (124 commits)")[![ionutpad](https://avatars.githubusercontent.com/u/31656944?v=4)](https://github.com/ionutpad "ionutpad (72 commits)")[![mike-ionut-mihai-sandu-tao](https://avatars.githubusercontent.com/u/50211080?v=4)](https://github.com/mike-ionut-mihai-sandu-tao "mike-ionut-mihai-sandu-tao (37 commits)")[![tikhanovichA](https://avatars.githubusercontent.com/u/1053022?v=4)](https://github.com/tikhanovichA "tikhanovichA (28 commits)")[![bartlomiejmarszal](https://avatars.githubusercontent.com/u/16231681?v=4)](https://github.com/bartlomiejmarszal "bartlomiejmarszal (21 commits)")[![gyszucs](https://avatars.githubusercontent.com/u/4942018?v=4)](https://github.com/gyszucs "gyszucs (18 commits)")[![shpran](https://avatars.githubusercontent.com/u/59471572?v=4)](https://github.com/shpran "shpran (17 commits)")[![boajer](https://avatars.githubusercontent.com/u/4569734?v=4)](https://github.com/boajer "boajer (15 commits)")[![krampstudio](https://avatars.githubusercontent.com/u/468620?v=4)](https://github.com/krampstudio "krampstudio (15 commits)")[![Yury-Razhkou](https://avatars.githubusercontent.com/u/51408369?v=4)](https://github.com/Yury-Razhkou "Yury-Razhkou (9 commits)")[![zagovorichev](https://avatars.githubusercontent.com/u/1445911?v=4)](https://github.com/zagovorichev "zagovorichev (9 commits)")[![siwane](https://avatars.githubusercontent.com/u/8009602?v=4)](https://github.com/siwane "siwane (8 commits)")[![bychart](https://avatars.githubusercontent.com/u/29703409?v=4)](https://github.com/bychart "bychart (8 commits)")[![bugalot](https://avatars.githubusercontent.com/u/4217431?v=4)](https://github.com/bugalot "bugalot (7 commits)")[![SergiiTao](https://avatars.githubusercontent.com/u/36041347?v=4)](https://github.com/SergiiTao "SergiiTao (7 commits)")[![no-chris](https://avatars.githubusercontent.com/u/11467480?v=4)](https://github.com/no-chris "no-chris (7 commits)")[![jbout](https://avatars.githubusercontent.com/u/5815304?v=4)](https://github.com/jbout "jbout (5 commits)")[![augustas](https://avatars.githubusercontent.com/u/2705327?v=4)](https://github.com/augustas "augustas (5 commits)")[![btamas](https://avatars.githubusercontent.com/u/537151?v=4)](https://github.com/btamas "btamas (5 commits)")[![chilly86](https://avatars.githubusercontent.com/u/4863925?v=4)](https://github.com/chilly86 "chilly86 (5 commits)")

---

Tags

queuetaskTAOcomputer-based-assessmentOAT

### Embed Badge

![Health badge](/badges/oat-sa-extension-tao-task-queue/health.svg)

```
[![Health](https://phpackages.com/badges/oat-sa-extension-tao-task-queue/health.svg)](https://phpackages.com/packages/oat-sa-extension-tao-task-queue)
```

###  Alternatives

[oat-sa/tao-core

TAO core extension

66136.7k74](/packages/oat-sa-tao-core)[oat-sa/extension-tao-itemqti-pci

1085.9k6](/packages/oat-sa-extension-tao-itemqti-pci)[oat-sa/generis

TAO generis library

11140.3k76](/packages/oat-sa-generis)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
