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

How to set exceptionPredicate via API #2106

Open
david0 opened this issue Feb 2, 2024 · 0 comments
Open

How to set exceptionPredicate via API #2106

david0 opened this issue Feb 2, 2024 · 0 comments

Comments

@david0
Copy link

david0 commented Feb 2, 2024

We are using resilience4j with spring, but without the aop.

I would prefer if we could wire the things like the predicates in the java code, but keep stuff like maxAttempts configurable via yaml.

currently the best I came up with is this:

	@Bean
	Retry retry(RetryRegistry retryRegistry) {
		var retryConfig = RetryConfig.from(retryRegistry.retry("foo").getRetryConfig())
				.retryOnException(new MyRetryPredicate())
				.build();
		return Retry.of("foo", retryConfig);
	}

Is there some a nicer way to do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant