-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Resend failed messages to failure transport using a delay from retry strategy #57672
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
base: 6.4
Are you sure you want to change the base?
[Messenger] Resend failed messages to failure transport using a delay from retry strategy #57672
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
c6a8bbf
to
ee16513
Compare
* | ||
* @group integration | ||
*/ | ||
class FailureTransportIntegrationTest extends TestCase |
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.
Somewhat torn on this test as it requires so much setup.
I created it, as the "failure" logic broke with the change in AmqpSender
and no auomated test caught it
src/Symfony/Component/Messenger/EventListener/SendFailedMessageToFailureTransportListener.php
Outdated
Show resolved
Hide resolved
Use retry strategy with an increasing delay to prevent handling failed messages too fast/often
…r failure listener
…ailure transport The failure transport uses a delay - the retry routing key from the previous stamp would interfere with publishing to the failure exchange/queue
ee16513
to
ea61fcb
Compare
This PR tries to fix #53216 and is a follow-up to #51815
It is somewhat of a stretch to call this a fix, as it changes behavior
and especially breaks the BC promise.My sole argumentation for a fix would be that discarding instead of retrying messages is unexpected behavior, but this is subjective.
With changed behavior, I am very much open for comments and suggestions.
The changes are:
SendFailedMessageToFailureTransportListener
does no longer discard messages if a message was already sent to a failure transport but uses a retry strategy to re-send it to the failure transport using an increasing delaySendFailedMessageToFailureTransportListener
uses the lastReceivedStamp
in order to not lose information about the original transportFailedMessageProcessingMiddleware
is usedfrom_transport
) would not be considered as a handler when retrieving retries from a failure transportMutliplierRetryStrategy
counts allRedeliveryStamps
to determine the delay instead of the current retry loopAmqpSender
does no longer default to where a message was previously received from as a routing key, when sending it to the failure transportfanout
binding setup, but interferes with routing in the delay exchangeLimitations:
RedeliveryStamps
is not reliable asSendFailedMessageForRetryListener
limits (removes) themRedeliveryStamp
Changing the retry behavior
and the public constructorof the EventListener is definitely a breaking change. It's impossible to tell if a project relies on the fact that messages are discarded from the failure transport.The constructor change is handled gracefully but it still requires some sort of default delay in order to not introduce the regression of an instant and infite retry loop.
Again, really happy for feedback!