[Messenger] Resend failed messages to failure transport using a delay from retry strategy #57672
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.
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!