8000 [FrameworkBundle] Make StopWorkerOnSignalsListener configurable via messenger's config by rmikalkenas · Pull Request #49702 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Make StopWorkerOnSignalsListener configurable via messenger's config #49702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CHANGELOG
* Add `AbstractController::sendEarlyHints()` to send HTTP Early Hints
* Add autowiring aliases for `Http\Client\HttpAsyncClient`
* Deprecate the `Http\Client\HttpClient` service, use `Psr\Http\Client\ClientInterface` instead
* Add `stop_worker_on_signals` configuration option to `messenger` to define signals which would stop a worker

6.2
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1528,6 +1528,11 @@ function ($a) {
->thenInvalid('The "framework.messenger.reset_on_message" configuration option can be set to "true" only. To prevent services resetting after each message you can set the "--no-reset" option in "messenger:consume" command.')
->end()
->end()
->arrayNode('stop_worker_on_signals')
->defaultValue([])
->info('A list of signals that should stop the worker; defaults to SIGTERM and SIGINT.')
->integerPrototype()->end()
->end()
->scalarNode('default_bus')->defaultNull()->end()
->arrayNode('buses')
->defaultValue(['messenger.bus.default' => ['default_middleware' => ['enabled' => true, 'allow_no_handlers' => false, 'allow_no_senders' => true], 'middleware' => []]])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2050,6 +2050,10 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
$container->getDefinition('messenger.transport.beanstalkd.factory')->addTag('messenger.transport_factory');
}

if ($config['stop_worker_on_signals']) {
$container->getDefinition('messenger.listener.stop_worker_signals_listener')->replaceArgument(0, $config['stop_worker_on_signals']);
}

if (null === $config['default_bus'] && 1 === \count($config['buses'])) {
$config['default_bus'] = key($config['buses']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
'default_bus' => null,
'buses' => ['messenger.bus.default' => ['default_middleware' => ['enabled' => true, 'allow_no_handlers' => false, 'allow_no_senders' => true], 'middleware' => []]],
'reset_on_message' => true,
'stop_worker_on_signals' => [],
],
'disallow_search_engine_index' => true,
'http_client' => [
Expand Down
0