mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-30 17:59:33 +00:00
Feature: [docgen] generate documents in an async queue
The documents are now generated in a queue, using symfony messenger. This queue should be configured:
```yaml
# app/config/messenger.yaml
framework:
messenger:
# reset services after consuming messages
# reset_on_message: true
failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
async: '%env(MESSENGER_TRANSPORT_DSN)%'
priority:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
failed: 'doctrine://default?queue_name=failed'
routing:
# ... other messages
'Chill\DocGeneratorBundle\Service\Messenger\RequestGenerationMessage': priority
```
`StoredObject`s now have additionnal properties:
* status (pending, failure, ready (by default) ), which explain if the document is generated;
* a generationTrialCounter, which is incremented on each generation trial, which prevent each generation more than 5 times;
The generator computation is moved from the `DocGenTemplateController` to a `Generator` (implementing `GeneratorInterface`.
There are new methods to `Context` which allow to normalize/denormalize context data to/from a messenger's `Message`.
This commit is contained in:
@@ -20,10 +20,14 @@ services:
|
||||
resource: '../Serializer/Normalizer/'
|
||||
tags:
|
||||
- { name: 'serializer.normalizer', priority: -152 }
|
||||
|
||||
Chill\DocGeneratorBundle\Serializer\Normalizer\CollectionDocGenNormalizer:
|
||||
tags:
|
||||
- { name: 'serializer.normalizer', priority: -126 }
|
||||
|
||||
Chill\DocGeneratorBundle\Service\Context\:
|
||||
resource: "../Service/Context"
|
||||
|
||||
Chill\DocGeneratorBundle\Controller\:
|
||||
resource: "../Controller"
|
||||
autowire: true
|
||||
@@ -34,18 +38,20 @@ services:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\DocGeneratorBundle\Service\Context\:
|
||||
resource: "../Service/Context/"
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\DocGeneratorBundle\GeneratorDriver\:
|
||||
resource: "../GeneratorDriver/"
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\DocGeneratorBundle\Service\Messenger\:
|
||||
resource: "../Service/Messenger/"
|
||||
|
||||
Chill\DocGeneratorBundle\Service\Generator\Generator: ~
|
||||
Chill\DocGeneratorBundle\Service\Generator\GeneratorInterface: '@Chill\DocGeneratorBundle\Service\Generator\Generator'
|
||||
|
||||
Chill\DocGeneratorBundle\Driver\RelatorioDriver: '@Chill\DocGeneratorBundle\Driver\DriverInterface'
|
||||
|
||||
Chill\DocGeneratorBundle\Context\ContextManager:
|
||||
arguments:
|
||||
$contexts: !tagged_iterator { tag: chill_docgen.context, default_index_method: getKey }
|
||||
Chill\DocGeneratorBundle\Context\ContextManagerInterface: '@Chill\DocGeneratorBundle\Context\ContextManager'
|
||||
|
||||
Reference in New Issue
Block a user