-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Add EventListener to handle delayed Messages on kernel.terminate
event
#50075
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
Conversation
...Symfony/Component/Messenger/EventListener/HandleDelayedMessagesOnKernelTerminateListener.php
Outdated
Show resolved
Hide resolved
0add76d
to
12d0402
Compare
If you have a time consuming task, why are you running the handler during the request instead of in a separate process? |
Adding separate consumers for some simple tasks can increase complexity of the infrastructure. |
@@ -1519,6 +1519,10 @@ function ($a) { | |||
->defaultNull() | |||
->info('Transport name to send failed messages to (after all retries have failed).') | |||
->end() | |||
->scalarNode('delayed_transport') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find the naming confusing. To me, it sounds like my message could be delayed no matter the transport used (like this) while this option actually brings a different strategy of handling the message: using the kernel.terminate
event.
Maybe handle_after_request
would be more suitable?
How about using stamp+middleware, similar to Also this would make it easy to ignore the "delaying" behavior when running on CLI. |
Closing as there is no more activity here. Please feel free to reopen |
This PR adds possibility to register special "delayed" in-memory transport to delay messages handling on
kernel.terminate
event. It can be useful for non-critical but time-consuming operations like sending some analytics, metrics, various experiments like Parallel running, etc.🔧 Usage:
🗒️ Todo: