Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Mailer][Transport] Allow exception logging forRoundRobinTransport mailer#60110

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jnoordsij wants to merge3 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromjnoordsij:roundrobin-mailer-error-handler

Conversation

jnoordsij
Copy link
Contributor

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
IssuesN/A
LicenseMIT

TheRoundRobinTransport class (and by extension theFailoverTransport class) allow one to mail using different mail transports, with automatic failover in case a mailer fails. In case of such a failure, exceptions are caught (and grouped in case of multiple failures) and the next transport is attempted. This ensures that as long as one transport succeeds, the mail will be delivered.

However, the current way of exception handling also means that exceptions on failing transports will never bubble up, unless all of them fail at once. This means that in case of a prolonged failure of a transport, e.g. due to misconfiguration, the only way to detect such a failure is by noting that a intended mailer is never sending mail, rather then be warned by actual exceptions of your application. If this is not detected, then one will only discover once all senders are failing, that one of them might have been failing all of the time already.

To allow one to be notified of all exceptions happening within the handling of sending a mail, I propose to add an$exceptionHandler property to the class, that would allow one to manually add a callback for handling exceptions in an additional way. For example, this would allow one to manually send the exception to some service in a structured manner, so one can address the failing transport, while sending would still continue properly as long as there's still a succeeding transport left.

@carsonbot

This comment was marked as outdated.

@jnoordsijjnoordsij marked this pull request as ready for reviewApril 1, 2025 12:37
@carsonbotcarsonbot added this to the7.3 milestoneApr 1, 2025
@carsonbotcarsonbot changed the title[Mailer][Transport] Allow custom exception handling for RoundRobinTransport mailer[Mailer] [Transport] Allow custom exception handling for RoundRobinTransport mailerApr 1, 2025
@stof
Copy link
Member

stof commentedApr 1, 2025

Injecting an exception handler callback looks uncommon to me. This looks like a use case for injecting a logger and performing some logging.

@jnoordsijjnoordsijforce-pushed theroundrobin-mailer-error-handler branch from40b9b2c to4de5ed8CompareApril 1, 2025 13:29
@jnoordsij
Copy link
ContributorAuthor

Thanks for your suggestion! While I figured a callback would allow for more flexibility, I do agree that a logger is probably a more standard way of approaching this. I've adjusted to inject aLoggerInterface instead. Let me know what you think!

@jnoordsijjnoordsij changed the title[Mailer] [Transport] Allow custom exception handling for RoundRobinTransport mailer[Mailer] [Transport] Allow custom exception logging for RoundRobinTransport mailerApr 1, 2025
@jnoordsijjnoordsij changed the title[Mailer] [Transport] Allow custom exception logging for RoundRobinTransport mailer[Mailer] [Transport] Allow exception logging for RoundRobinTransport mailerApr 1, 2025
@OskarStarkOskarStark changed the title[Mailer] [Transport] Allow exception logging for RoundRobinTransport mailer[Mailer][Transport] Allow exception logging forRoundRobinTransport mailerApr 2, 2025
@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

4 participants
@jnoordsij@carsonbot@stof@fabpot

[8]ページ先頭

©2009-2025 Movatter.jp