Download the PHP package mnk1985/amqp-tasks-bundle without Composer
On this page you can find all versions of the php package mnk1985/amqp-tasks-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package amqp-tasks-bundle
Installation
add RabbitMQ connection details to .env file. e.g.
Note: As long as you are on Symfony Flex you are done. If not, you have to do some extra things, like registering the bundle in your AppKernel
class.
Base components:
- Task - stores queue name in the underlying queue system, knows its handler and dto serializer
- DTO - data structure which stores all the data we need to pass in order to be able to process job asynchronously (e.g. to make async search we can pass some filter details)
- DTOSerializer - is an object which can transform dto to string and vice versa
- TaskHandler - receives dto and does processing (any components can be injected if needed)
UML class diagram may be helpful for visualization
Examples
Task (should implement TaskInterface or extend AbstractTask). getQueueName should return real queue name used to store/retrieve data from queue driver. TestTask::getDTOSerializer returns specific to your task serializer. TestTask::getHandler returns task's handler. The convention is that handler comes with 'Handler' suffix to task name (e.g. from TestTask we get TestTaskHandler, but it can be overwritten via TestTask::setHandler)
TaskHandler (should implement TaskhandlerInterface or extend AbstractTaskHandler) - here you can process your task. if it's processed successfully - return true, otherwise - false.
Object that gets passed via queue for async processing
Serializer should implement DTOSerializerInterface (with 2 methods - convert to string and from string)
and controller which will trigger publishing/consuming
console command for processing tasks.
without --verbose task payload won't be outputted (to console screen or supervisor log) --iterations=0 (by default) makes worker running "forever" (you may set it to 100. when task is executed as times as iterations are defined, will die, but supervisord will alive it again) --attempts=2 - make another try if fist processing failed --delay - delay in seconds when retry after fail
All versions of amqp-tasks-bundle with dependencies
ext-iconv Version *
doctrine/collections Version ^1.5
php-amqplib/php-amqplib Version ^2.7
symfony/framework-bundle Version ^3|^4
symfony/yaml Version ^4.0