Download the PHP package sunvalley-technologies/php-task-manager-symfony-bundle without Composer
On this page you can find all versions of the php package sunvalley-technologies/php-task-manager-symfony-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sunvalley-technologies/php-task-manager-symfony-bundle
More information about sunvalley-technologies/php-task-manager-symfony-bundle
Files in sunvalley-technologies/php-task-manager-symfony-bundle
Package php-task-manager-symfony-bundle
Short Description Symfony bundle for PHP Task Manager
License MIT
Informations about the package php-task-manager-symfony-bundle
PHP Task Manager - Symfony Bundle
See main repository for base usage
This bundle integrates the task manager to Symfony. Supports Symfony ^3.0 and ^4.0.
Installing
composer require sunvalley-technologies/php-task-manager-symfony-bundle
Make sure to add the bundle to your Kernel's bundles.
Configuration
Complete configuration looks like following:
`
From which task_queue
is the only required configuration parameter.
task_storage
is optional and if given is used to store task information.
If you have a non-standard Kernel have a look and replace the SunValley\TaskManager\Symfony\Task\TaskEnvironment
class
and AbstractSymfonyTask
to provide a proper Kernel for your tasks.
Generating and Submitting Tasks
It is necessary to generate tasks to control exactly what each task is doing. This can be thought like generating controllers.
All kernel dependent classes should extend AbstractSymfonyTask
and they are synchronous tasks by default.
Here is a sample task that persist a doctrine entity:
``
The call to finishTask
or failTask
is optional unlike on plain task manager tasks. Any exception that is thrown however is caught and reported back with failTask($error)
.
To submit a task, the task should be constructed and then it can be submitted with the client as on the example service above.
Task constructors should never block otherwise the main task manager loop can also get blocked.
Starting task manager
Console command task:manager
can be used to start the task manager.
In order to attach to your running loops that you also started with Symfony there is a factory for task manager SunValley\TaskManager\Symfony\Task\TaskManagerFactory
.
Task manager uses the loop php_task_manager_loop
defined in its configuration by default.
Many of these can be changed with a compiler pass in case a customization is necessary.
Other Topics
Doctrine Entity Repository Task
\SunValley\TaskManager\Symfony\Doctrine\EntityRepositoryTask
task can be used to offload synchronous doctrine calls to background for async apps.
This task does not make sense for usual work queues but can be useful for async apps that partially depend on doctrine for ORM access.
All versions of php-task-manager-symfony-bundle with dependencies
symfony/framework-bundle Version ^3.0|^4.0|^5.0
symfony/validator Version ^3.0|^4.0|^5.0
sunvalley-technologies/php-task-manager Version ^1.2.4