-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Fix forced bus name gone after an error in delayed message handling #51468
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
nicolas-grekas
merged 1 commit into
symfony:6.3
from
valtzu:fix-missing-stamps-after-delayed-fail
Sep 29, 2023
Merged
[Messenger] Fix forced bus name gone after an error in delayed message handling #51468
nicolas-grekas
merged 1 commit into
symfony:6.3
from
valtzu:fix-missing-stamps-after-delayed-fail
Sep 29, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5080561
to
9f2ff70
Compare
Added a test case to demonstrate the issue. I wonder if |
9f2ff70
to
2f04a64
Compare
Thank you @valtzu. |
Merged
@nicolas-grekas shouldn't it be this way?
Currently it seems like a BC for me. I know it's a bug, but it can be fixed in a backward compatible way. |
GSadee
added a commit
to Sylius/Sylius
that referenced
this pull request
Oct 4, 2023
…akubtobiasz) This PR was merged into the 1.13 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.12 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | n/a | License | MIT ref: symfony/symfony#51468 Commits ------- b724783 Fix failing phpspec scenario on Symfony 6.3.5 and above
GSadee
added a commit
to Sylius/SyliusApiBundle
that referenced
this pull request
Oct 4, 2023
…akubtobiasz) This PR was merged into the 1.13 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.12 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | n/a | License | MIT ref: symfony/symfony#51468 Commits ------- b724783ab2e57b5ee3b04702473e917dc5fa4bad Fix failing phpspec scenario on Symfony 6.3.5 and above
nicolas-grekas
added a commit
that referenced
this pull request
Oct 25, 2023
…ackwards compatibility (xabbuh) This PR was merged into the 6.3 branch. Discussion ---------- [Messenger] declare constructor argument as optional for backwards compatibility | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #51468 (comment) | License | MIT Commits ------- 3810053 declare constructor argument as optional for backwards compatibility
fabpot
added a commit
that referenced
this pull request
May 7, 2024
…s (valtzu) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Messenger] Don't drop stamps when message validation fails | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT `ValidationMiddleware` has the same issue as `DispatchAfterCurrentBusMiddleware` did before the [fix](#51468): if message validation fails, stamps added by previous middlewares in the stack are dropped. What this means in practice is: 1. `bin/console messenger:consume --bus=external` receives a message and `AddBusNameStampMiddleware` adds the `BusNameStamp` so that in case of failure it would be routed to a correct bus 2. The message fails validation – the original envelope without the added `BusNameStamp` is sent to failure queue 3. When running `bin/console messenger:failed:retry`, the message is dispatched on wrong bus (the default one) This has really bad implications if you handle the message differently depending on which bus it is received. Some refactoring was done to reduce duplication, similar to `WrappedExceptionsTrait`/`WrappedExceptionsInterface`. Commits ------- fed32dc [Messenger] Don't drop stamps when message validation fails
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When consuming messages from an external source which do not have metadata/headers like bus name, you have to force the bus name with
--bus
in themessenger:consume
command. However, if in the message handler you dispatch another message withDispatchAfterCurrentBusStamp
, which then fails, end result is that the original message from external source is retried, but that forced bus name (BusNameStamp
) is lost – so it will be retried on default bus instead. This isn't intended behavior, is it?Not sure if changing
DelayedMessageHandlingException::__construct
signature is considered a BC break, it is not marked as internal so I am a bit worried 🤔