Issue Feature Closed

#106261Add --time-limit option to messenger:consume

Bastian Stargazer 02/26/25, 20:41 updated 03/31/26, 09:00

Description

The original Symfony messenger (https://symfony.com/doc/current/messenger.html) has an option —time-limit to specify, how long the messenger:consume service should run before shuts down automatically.

This is useful for environments, where it is not possible to create a system service which re-starts automatically, e.g. in shared-hosting environments (or on all other servers without root access).

In this case it would be nice, if the messenger:consume could be triggered regularly e.g. by the Scheduler (The Scheduler already can be triggered regularly by external HTTP Cron request).

For example: Lets say, the messenger command is scheduled with **/5 * * * ** and executes messenger:consume —time-limit=16200. So it runs for a bit, shuts down after 4,5 minutes and is restarted if the scheduler invokes the command again after the next 5 minutes passed.

Reviews 2

History 617

  1. Oliver Hader commented <span data-processor="relativetime" data-value="2025-08-21T10:27:15+00:00" > 08/21/25, 10:27 </span>

    Symfony uses their own event dispatcher, which allows dynamically added listeners.

    Our TYPO3 is “static”, since we don’t allow that yet. Even \TYPO3\CMS\Core\EventDispatcher\ListenerProvider::addListener only allows static service names, but no stateful-instances or closures.

  2. Oliver Hader commented <span data-processor="relativetime" data-value="2025-08-21T10:45:13+00:00" > 08/21/25, 10:45 </span>

    With the current implementation in TYPO3, ConsumeMessagesCommand would have to be shared and would require a dedicated ConsumeMessagesCommand::handleWorkerRunningEvent(WorkerRunningEvent $event) which re-implements (our existing) StopWorkerOnTimeLimitListener.

    Thus, I’d suggest to finally allow dynamically adding event listeners.

  3. Gerrit Code Review pushed patch set 1 for main to change 91451 status Accepted Under Review <span data-processor="relativetime" data-value="2025-11-08T15:46:43+00:00" > 11/08/25, 15:46 </span>

  4. Sascha Nowak commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-02-27T17:25:09+00:00" > 02/27/26, 17:25 </span>

    Applied in changeset commit:99fc701d3f710f430824bbbdb039335211a1a18e.