Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Messenger multiple failed transports#38468
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Messenger multiple failed transports#38468
Uh oh!
There was an error while loading.Please reload this page.
Conversation
c9bd097 tobcb3783Comparemonteiro commentedOct 7, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@weaverryan i have removed some of the tests because of merging conflicts.. since this is still being changed a lot... after we agree on an implementation it’s easy to fix them. |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
monteiro commentedOct 15, 2020
@weaverryan I just uploaded a working version of your proposal. Feel free to review, before I do the tests. Thanks! |
weaverryan left a comment
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.
Getting close...
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
monteiro commentedDec 31, 2020 via email
Waiting for Ryan to help me.He has been reviewing my PR since the beginning.Let me talk with him, to see what can we do.Thanks for pinging. …On Thu, Dec 31, 2020 at 9:04 AM Kamil Ścisłowski ***@***.***> wrote: How long it will take to be merged into master?@monteiro <https://github.com/monteiro> are you still working on it? :) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#38468 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAASFW36LHEU3O7E3DDWKWTSXQ5ANANCNFSM4SHURUVA> . |
escees commentedDec 31, 2020
Sure, I've deleted previous comment because I wasn't sure if it's appropriate place to ask :) But I appreciate for answering. For me and I see that not only for me it's really important feature that is missing from core. |
monteiro commentedJan 1, 2021
@escees no worries. I already talked with@weaverryan to help me during this 2021 to merge this missing feature. |
rkazaniszyn commentedMar 12, 2021
Fingers crossed for this to be completed and merged :) |
weaverryan left a comment
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.
Thanks for you work on this - we're getting ever close - so many little details :)
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/EventListener/SendFailedMessageToFailureTransportListener.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/EventListener/SendFailedMessageToFailureTransportListener.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
b2cc3f6 to303514eComparesrc/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
monteiro commentedMar 22, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@weaverryan I have done all changes, including fixing all the tests:
which I don't know how to fix, related to that weird extra parameter code inhttps://github.com/symfony/symfony/pull/38468/files#diff-9213ec846d94497cc34a4b922373cb52e0d53015604427a4aec0661289c58ac8R177
|
weaverryan left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
EDIT
The below issue is NOT an issue. It's caused by the retry commands being allowed to query the wrong transport. Basically, the fix in#40588 closes this possibility. There is no problem here.
I've been playing with this, and it's looking really good - it's close.
But I just hit one major problem. Suppose this setup"
framework:messenger:failure_transport:failure_transport1transports:transport2:dsn:doctrine://defaultoptions:queue_name:transport2failure_transport:failure_transport2failure_transport1:dsn:doctrine://defaultoptions:queue_name:failure_transport1failure_transport2:dsn:doctrine://defaultoptions:queue_name:failure_transport2routing:App\Message\ILikeToFail:transport2
TheILikeToFail fail message is routed totransport2. So if it fails, it is sent tofailure_transport2. Great! Now, if I retry that message fromfailure_transport2 and it fails, it is sent tofailure_transport1. That is not correct.
It makes sense why it's doing this.failure_transport2 is a normal transport. So when the message fails, it actually looks at itsown "failure transport" config and determines that the message should go to the "global failure transport", which isfailure_transport1. But I don't think this is the behavior we want: the message should go back tofailure_transport2 after failing. That is THIS message's failure transport, and it should remain here until it is successful or removed because it hits the retry limit.
tl;dr We need a way to respect the original failure transport that message was routed to. We probably need (if we don't have this already) a stamp to save the "failure transport name" onto a message, so it can be read when being re-delivered after the messages fails a retry from the failure queue.
src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| $io->comment(sprintf('Showing first %d messages.',$max)); | ||
| } | ||
| $io->comment('Run <comment>messenger:failed:show {id} -vv</comment> to see message details.'); |
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.
this line (and a few other ones in this command... and maybe other commands, like:retry and:remove) now needs to include--failure-transport= if that option was passed. Otherwise, you will be looking for the message in the wrong transport.
Btw, with Doctrine as your failure transport, forgetting the--failure-transport= option actually DOES work... but due to a bug I just discovered (that we should fix, in a different PR). Thefind() method in the Doctrine connection class incorrectly does NOT include theAND queue_name = ? part.
symfony/src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php
Lines 278 to 281 in2da27bb
| publicfunctionfind($id): ?array | |
| { | |
| $queryBuilder =$this->createQueryBuilder() | |
| ->where('m.id = ?'); |
src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Command/FailedMessagesShowCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
monteiro commentedMar 23, 2021
Pending to fix the console command tests after adding the list of transports and the warning. |
c14fa3d to336c9b6Compare…ransport (monteiro)This PR was merged into the 4.4 branch.Discussion----------add missing queue_name to find(id) in doctrine messenger transport| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| License | MITThis bug was noticed by@weaverryan when reviewing the PR:#38468 related to multiple failure transports.Commits-------bb26a92 add missing queue_name to find(id) in doctrine messenger transport
src/Symfony/Component/Messenger/EventListener/SendFailedMessageToFailureTransportListener.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/EventListener/SendFailedMessageToFailureTransportListener.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
chalasr left a comment
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.
Great work. Some comments above
monteiro commentedMar 30, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks@chalasr. Already fixed with your suggestions. |
605fc7b to5810b6cComparechalasr commentedMar 30, 2021
It took time, but here we go, this is in now. Thank you very much@monteiro. |
monteiro commentedMar 30, 2021
Thanks@chalasr again! |
…sCommand (nicolas-grekas)This PR was merged into the 5.3-dev branch.Discussion----------[Messenger] fix deprecation layer in AbstractFailedMessagesCommand| Q | A| ------------- | ---| Branch? | 5.x| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | -| License | MIT| Doc PR | -Added in#38468, spotted in#40643Commits-------079cb31 [Messenger] fix deprecation layer in AbstractFailedMessagesCommand
This PR was squashed before being merged into the 5.3-dev branch.Discussion----------[Messenger] Multiple failed transports<!--If your pull request fixes a BUG, use the oldest maintained branch that containsthe bug (seehttps://symfony.com/roadmap for the list of maintained branches).If your pull request documents a NEW FEATURE, use the same Symfony branch wherethe feature was introduced (and `master` for features of unreleased versions).-->### New Feature: Messenger: Multiple Failure Transports Transportscloses#15168This PR adds the documentation related to PR:symfony/symfony#38468What it needs to be clear in the documentation:- You can define multiple transports, one per transport (instead of the global one, as it is supported today)- If you don't define a global failure transport and if the transport does not have the `failure_transport` configured the messages will be discarded- If you define both a global and at the transport level, the `failure_transport` configuration, the one taken into account is at the transport level configuration.- The failed commands have an option argument to specify the transport level `--transport`. Without arguments is the global failed transport taken into account.Commits-------d784895 [Messenger] Multiple failed transports
…tence alias being used (monteiro)This PR was squashed before being merged into the 5.3 branch.Discussion----------[Messenger] fix BC for FrameworkBundle 4.4 with a non-existence alias being used| Q | A| ------------- | ---| Branch? | 5.3| Bug fix? | yes| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets |Fix#41545 ... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->| License | MITWhen trying to update symfony/messenger to 5.3 while still using symfony/framework-bundle 4.4 there is an error:The service "console.command.messenger_failed_messages_retry" has a dependency on a non-existent service "messenger.failure_transports.default".This is because in Symfony Messenger 5.3, on the PR#38468 to support multiple failure transports we have created an alias, that is only available on the FrameworkBundle 5.3.This fix will use an already existence alias.Sample project to test this behavior:https://github.com/monteiro/PR-41553-symfonyCommits-------aa0e166 [Messenger] fix BC for FrameworkBundle 4.4 with a non-existence alias being used
Strategy applied
SendFailedMessageToFailureTransportListener. This way we re-use the same listener.Configuration example
You can test this feature easily on ademo project. Just follow theREADME.
More information on issue#34911
What needs to be done so this can be merged: