adt / background-queue-rabbitmq
Background queue for Nette using RabbitMQ.
Installs: 2 970
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 13
Forks: 1
Open Issues: 0
Requires
- php: ^7.4|^8.0
- adt/background-queue: ^4.22
- nette/di: ^2.4|^3.0
- nette/schema: ^1.2
- dev-main
- v2.9.1
- v2.9
- v2.8
- v2.7
- v2.6.8
- v2.6.7
- v2.6.6
- v2.6.5
- v2.6.4
- v2.6.3
- v2.6.2
- v2.6.1
- v2.6
- v2.5.2
- v2.5.1
- v2.5
- v2.4.1
- v2.4
- v2.3.2
- v2.3.1
- v2.3
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2
- v2.1.1
- v2.1
- v2.0
- v1.0.1
- v1.0
- dev-priorities-range
- dev-entity-extend
- dev-priorities
- dev-extend-monitoring
This package is auto-updated.
Last update: 2024-10-17 09:29:17 UTC
README
1 Installation & Configuration
1.1 Installation
composer require adt/background-queue-nette
1.2 Configuration
parameters: database: serverVersion: '8.0' driver: pdo_mysql host: %env.DB_HOST% port: %env.DB_PORT% user: %env.DB_USER% password: %env.DB_PASSWORD% dbname: %env.DB_DBNAME% backgroundQueue: queue: %env.PROJECT_NAME% extensions: backgroundQueue: ADT\BackgroundQueueNette\DI\BackgroundQueueExtension backgroundQueue: callbacks: sendEmail: [@App\Model\Mailer, sendEmail] sendEmail2: # možnost specifikace jiné fronty pro tento callback callback: [@App\Model\Mailer, sendEmail] queue: some_other_queue notifyOnNumberOfAttempts: 5 # počet pokusů o zpracování záznamu před zalogováním tempDir: %tempDir% # cesta pro uložení informace, že byla provedena aktualizace databázové struktury locksDir: %locksDir% # cesta pro uložení zámku proti vícenásobnému spuštění commandů connection: %database% # parametry predavane do Doctrine\Dbal\Connection queue: %backgroundQueue.queue% # název fronty, do které se ukládají a ze které se vybírají záznamy tableName: background_job # nepovinné, název tabulky, do které se budou ukládat jednotlivé joby logger: Tracy\Bridges\Psr\TracyToPsrLoggerAdapter(\Tracy\Debugger::getLogger()) # nepovinné, musí implementovat psr/log LoggerInterface onBeforeProcess: null # nepovinné onError: [ADT\Utils\Guzzle, handleException] # nepovinné onAfterProcess: null # nepovinné onProcessingGetMetadata: null # nepovinné
1.3 Broker (optional)
To get the best possible performance and user convenience, it's recommended to use AMQP broker (eg. RabbitMQ) https://github.com/AppsDevTeam/background-queue#131-php-amqplib-installation and configure it like this:
parameters: backgroundQueue: ... broker: connection: host: %env.BROKER_HOST% port: %env.BROKER_PORT% user: %env.BROKER_USER% password: %env.BROKER_PASSWORD% queue: arguments: {'x-queue-type': ['S', 'quorum']} services: backgroundQueue.broker.manager: ADT\BackgroundQueue\Broker\PhpAmqpLib\Manager(%backgroundQueue.broker.connection%, %backgroundQueue.broker.queue%) backgroundQueue.broker.producer: ADT\BackgroundQueue\Broker\PhpAmqpLib\Producer backgroundQueue.broker.consumer: ADT\BackgroundQueue\Broker\PhpAmqpLib\Consumer backgroundQueue: ... producer: @backgroundQueue.broker.producer waitingJobExpiration: 1000
1.4 Proxy (optional)
To avoid service circular references, it's recommended to use https://github.com/AppsDevTeam/nette-proxy and set BackgroundQueue as lazy:
services:
backgroundQueue.service:
tags: [lookyman.lazy]
2. Usage
https://github.com/AppsDevTeam/background-queue#2-pou%C5%BEit%C3%AD