Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Scheduler/retries and failures #49965

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

Closed
wants to merge 2 commits into from

Conversation

tucksaun
Copy link
Contributor

@tucksaun tucksaun commented Apr 6, 2023

Q A
Branch? 6.3
Bug fix? subjective
New feature? yes
Deprecations? no
Tickets Related to #49804
License MIT
Doc PR Can be directly integrated into symfony/symfony-docs#18067

Right now the handling of failures happening during Scheduled Messages handling is not great (see #49804).
#49964 allows one to be notified of errors and save failed messages if a failure transport is configured.

But one might want to have messages retried automatically which is not possible at the moment.
There are two approaches to this:

  • either we do nothing and one is encouraged to use RedispatchMessage to ensure retry happens when necessary on a transport supporting retries
  • or we allow a user to specify which transport should be used for retries, leveraging in memory for simple use cases.

This PR is an attempt at the second approach.
It allows one to define the scheduler transport with a retry option to the DSN:

framework:
    messenger:
        transports:
             scheduler_default: 'schedule://default?retry=async'

In case of failure when Messenger tries to send the message to ScheduleTransport it will then actually forward the envelope to the specified transport which will then be picked up by regular consumers.
For simple use cases, one can use the 'schedule://default?retry that will use the in-memory transport and the SchedulerTransport will then pick them up once available after the retry delay.

/cc @kbond @fabpot

tucksaun added 2 commits April 6, 2023 15:10
Currently, when the processing of a scheduled message fails, Messenger will not be able to go on because the SchedulerTransport will throw an exception. More importantly, the original error will be swallowed by this one and not sent to the failure transport if one is configured. By allowing message rejection, Messenger will continue working as expected.

This is the first step to more changes regarding failure handling in ScheduledMessage processing.
@tucksaun
Copy link
Contributor Author

tucksaun commented Apr 7, 2023

Closing per #49964 (comment) and #49964 (comment)

@tucksaun tucksaun closed this Apr 7, 2023
@tucksaun tucksaun deleted the scheduler/retries-and-failures branch April 8, 2023 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants