Skip to content
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

Add error handler for transactional event #34146

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hyh1016
Copy link

@hyh1016 hyh1016 commented Dec 24, 2024

Exceptions propagated from the transactional event listener are handled by TransactionSynchronizationUtils and are not rethrown.
However, the lack of a configurable error handler for these exceptions makes it difficult to customize exception handling during transactional event processing.
To address this, I added an abstract error handler that can be defined as follows:

@Component
public abstract class TransactionalEventErrorHandlerImpl extends TransactionalEventErrorHandler {

	// can inject other beans

	@Override
	public void handle(ApplicationEvent event, @Nullable Throwable ex) {
		// custom logic
	}

}

@pivotal-cla
Copy link

@hyh1016 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@hyh1016 Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants