Download the PHP package lamoda/queue-bundle without Composer
On this page you can find all versions of the php package lamoda/queue-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package queue-bundle
Lamoda Queue Bundle
Symfony bundle for convenient work with queues. Currently it supports RabbitMQ.
Installation
-
Install bundle
-
Extend
Lamoda\QueueBundle\Entity\QueueEntityMappedSuperclass
-
Configure bundle parameters
-
Register bundle
or add to
config/bundles.php
-
Migrate schema
- to create migration for table
-
- apply the migration
Setup
Create new exchange
-
Define new exchange constant
- Add new node to
old_sound_rabbit_mq.producers
with previous defined constant name, example:
Create new queue
-
Define new queue constant
-
Register consumer for queue in
old_sound_rabbit_mq.consumers
with previous defined constant name, example: -
Create job class, extend
AbstractJob
by example: -
Create job handler, implement HandlerInterface by example:
-
Tag handler at service container
-
Configure delay strategy parameters (optional)
In this block, you can config special delay behaviors for each queue. For this, you have to register new services that use one of several base strategies (ArithmeticProgressionStrategy, GeometricProgressionStrategy) or yours (for this you have to make Service Class that implements DelayStrategyInterface).
Each strategy service has to have a tag with name
lamoda_queue_strategy
and uniquekey
. After this, you can use thesekeys
for matching with queues inlamoda_queue.queues
section.By default, use GeometricProgressionStrategy with params (their you can customize in
lamoda_queue
config section): -
Add queue name in "codeception.yml" at
modules.config.AMQP.queues
- Execute
./bin/console queue:init
command
Usage
Init exchange and queues
Add job to queue
Run queued job
Requeue failed queues
Advanced usage
You can queue any primitive class, just implement QueueInterface
:
How to rerun queues
If you want to rerun queue, throw Lamoda\QueueBundle\Exception\RuntimeException
.
If you want mark queue as failed, throw any another kind of exception.
By default delay time is calculated exponentially. You can affect it through configuration.
Events
Lamoda\QueueBundle\Event\QueueAttemptsReachedEvent
When consumer wants to execute reached maximum attempts queue.
Properties:
- Queue Entity
QueueAttemptsReachedEvent::getQueue()
Development
PHP Coding Standards Fixer
Tests
Unit
All versions of queue-bundle with dependencies
ext-pdo Version *
ext-json Version *
doctrine/doctrine-bundle Version ^1.9 || ^2.0
doctrine/orm Version ~2.3
jms/serializer-bundle Version ^2.4 || ^3.0
php-amqplib/php-amqplib Version ~3.0
php-amqplib/rabbitmq-bundle Version ~2.9.0
symfony/config Version ^4.1 || ^5.0
symfony/console Version ^4.2 || ^5.0
symfony/dependency-injection Version ^4.2 || ^5.0
symfony/event-dispatcher Version ^4.3 || ^5.0
symfony/framework-bundle Version ^4.3
symfony/monolog-bundle Version ^3.3