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

Skip to content

[Scheduler] Allow messages from the SchedulerTransport to be rejected #49964

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
merged 1 commit into from
Apr 8, 2023

Conversation

tucksaun
Copy link
Contributor

@tucksaun tucksaun commented Apr 6, 2023

Q A
Branch? 6.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets Related to #49804
License MIT

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.

/cc @fabpot @kbond

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.
@kbond
Copy link
Member

kbond commented Apr 6, 2023

To clarify the on failure scenarios:

  1. no failure_transport configured: swallows the error and appropriate events are dispatched
  2. failure_transport configured: swallows the error, appropriate events are dispatched and sent to the failure transport (no retries)
  3. retry_strategy configured for your scheduler transport: ignored

Copy link
Member

@kbond kbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! I think we can mark this as a fix for #49804. Additional features could be added but it's no longer a bug.

@tucksaun
Copy link
Contributor Author

tucksaun commented Apr 6, 2023

Actually:
3. retry_strategy configured for your scheduler transport: a "cannot send messages" exception is thrown

@kbond
Copy link
Member

kbond commented Apr 6, 2023

Actually:
3. retry_strategy configured for your scheduler transport: a "cannot send messages" exception is thrown

That's better I think (doesn't give you the impression that they're being retried).

@fabpot
Copy link
Member

fabpot commented Apr 7, 2023

As the Scheduler component is all about recurring messages, I think they should never be retried.

@fabpot
Copy link
Member

fabpot commented Apr 7, 2023

If you want the message to be retried, you should use the RedispatchMessage feature to send the message to another transport that can be retried.

@kbond
Copy link
Member

kbond commented Apr 7, 2023

As the Scheduler component is all about recurring messages, I think they should never be retried.

I'm fine with this stance for #49965 but this PR is required imo.

@tucksaun
Copy link
Contributor Author

tucksaun commented Apr 7, 2023

I agree (and therefore closed #49965).
But this PR is required if we don't want workers to crash when the handling of a recurring message fails (because Messenger Worker will call reject when a failure happens leading to an unhandled exception)

@fabpot
Copy link
Member

fabpot commented Apr 8, 2023

Thank you @tucksaun.

@fabpot fabpot merged commit aaff87a into symfony:6.3 Apr 8, 2023
@tucksaun tucksaun deleted the scheduler/allow-rejection branch April 8, 2023 15:13
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.

4 participants