diff --git a/CHANGELOG.md b/CHANGELOG.md index 82cb3e45..cdb6fbbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Latest ------ ## Changes +* [#311](https://github.com/cleverage/process-bundle/issues/311) Deprecate the `cleverage_process.event_listener.data_queue` service and `DataQueueEventListener` (it keeps a copy of the `ProcessState` of every `cleverage_process.data_queue` event in memory, without limit): injecting or fetching the service triggers a deprecation, they will be removed in v6.0. Write your own listener of the event dispatched by the `event_dispatcher` task. Update documentation, add tests. * [#312](https://github.com/cleverage/process-bundle/issues/312) Add read-only interfaces for the process manager and the registries, implemented by the existing classes and autowired by their interface: `ProcessManagerInterface` (`execute()`), `ProcessConfigurationRegistryInterface` (`getProcessConfiguration()`, `getProcessConfigurations()`, `hasProcessConfiguration()`), `TransformerRegistryInterface` (`getTransformer()`, `getTransformers()`, `hasTransformer()`) and `TaskRegistryInterface` (`getTask()`). Type your services on them: the classes will be `final` in v6.0 (the services of the bundle will then be typed on the interfaces). Update documentation, add tests. * [#310](https://github.com/cleverage/process-bundle/issues/310) Process configuration tree: a task `error_strategy` other than `skip` or `stop` is deprecated (notice when the container is compiled; it was accepted and the process failed with "Unknown error strategy" when the task failed), it will be rejected in v6.0. The process `public` key is a boolean node: a non-boolean value is rejected when the container is compiled, instead of a `TypeError` when the configuration is built. Describe the nodes of the process, task and generic transformer configurations (`config:dump-reference clever_age_process`). Update documentation, add tests. * [#309](https://github.com/cleverage/process-bundle/issues/309) Composer: `ext-intl` is no longer required, it is suggested: it is only needed by the `slugify` transformer (`SlugifyTransformer`), which is replaced by a service failing with an explicit message when the extension is missing (`UnavailableServicesCompilerPass`). Update documentation, add tests. diff --git a/config/services/event.yaml b/config/services/event.yaml index 8bb1ae18..b0477581 100644 --- a/config/services/event.yaml +++ b/config/services/event.yaml @@ -2,5 +2,9 @@ services: cleverage_process.event_listener.data_queue: class: CleverAge\ProcessBundle\EventListener\DataQueueEventListener public: false + deprecated: + package: cleverage/process-bundle + version: '5.4' + message: 'The "%service_id%" service is deprecated, it will be removed in v6.0: write your own listener of the event dispatched by the event_dispatcher task.' tags: - { name: kernel.event_listener, event: cleverage_process.data_queue, method: pushData } diff --git a/docs/reference/tasks/event_dispatcher_task.md b/docs/reference/tasks/event_dispatcher_task.md index 3f1b8be9..89d1acb3 100644 --- a/docs/reference/tasks/event_dispatcher_task.md +++ b/docs/reference/tasks/event_dispatcher_task.md @@ -67,6 +67,11 @@ public function onDataQueue(EventDispatcherTaskEvent $event): void `CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent`. Every `EventDispatcherTask` without `event_name` then triggers the same listeners. +**Deprecated since 5.4, removed in v6.0**: the bundle listens to the `cleverage_process.data_queue` event with the +`cleverage_process.event_listener.data_queue` service (`DataQueueEventListener`), which keeps a copy of the +`ProcessState` of every event in memory. Injecting or fetching this service triggers an `E_USER_DEPRECATED` error: write +your own listener, as above. + **Deprecated since v5, removed in v6.0**: from v4.0 to v5.0, the `event_name` option was ignored and the event was always dispatched under its class name. To preserve backward compatibility, when `event_name` is set (and differs from the event class name) and listeners subscribe to `CleverAge\ProcessBundle\Event\EventDispatcherTaskEvent`, the event is also diff --git a/src/EventListener/DataQueueEventListener.php b/src/EventListener/DataQueueEventListener.php index d5f1bb89..9c54d756 100644 --- a/src/EventListener/DataQueueEventListener.php +++ b/src/EventListener/DataQueueEventListener.php @@ -22,6 +22,9 @@ * Used mostly for testing purpose. * * @internal + * + * @deprecated since cleverage/process-bundle 5.4, will be removed in 6.0: write your own listener of the event + * dispatched by the event_dispatcher task */ class DataQueueEventListener { diff --git a/tests/DependencyInjection/CleverAgeProcessExtensionTest.php b/tests/DependencyInjection/CleverAgeProcessExtensionTest.php index b94004ec..f85db280 100644 --- a/tests/DependencyInjection/CleverAgeProcessExtensionTest.php +++ b/tests/DependencyInjection/CleverAgeProcessExtensionTest.php @@ -213,4 +213,18 @@ public function testTheProcessManagerIsResetBetweenExecutions(): void $container->getDefinition('cleverage_process.manager.process')->getTag('kernel.reset') ); } + + public function testTheDataQueueListenerIsDeprecated(): void + { + $container = new ContainerBuilder(); + (new CleverAgeProcessExtension())->load([], $container); + + $id = 'cleverage_process.event_listener.data_queue'; + $definition = $container->getDefinition($id); + self::assertTrue($definition->isDeprecated()); + $deprecation = $definition->getDeprecation($id); + self::assertSame('cleverage/process-bundle', $deprecation['package']); + self::assertSame('5.4', $deprecation['version']); + self::assertStringStartsWith(\sprintf('The "%s" service is deprecated, it will be removed in v6.0', $id), $deprecation['message']); + } }