resilience4j: ignoreExceptions spring boot configuration - possible to ignore unknown classes to not fail on startup?
Resilience4j version: 2.2.0 Java version: 17
Hi, this is a general question. We make use of the “ignoreExceptions” property for circuit breakers and our application exception classes underwent a package change. When we deployed the code (with the new package location) but the config with the old location, it failed on startup due to r4j calling out the class is not found (which makes sense).
com.sample.app.SampleException (old) com.sample.app.new.SampleException (new)
We have our app configuration externalized not part of the build, so it’s quite the timing issue trying to match up the code and configuration to ensure things so smooth. We have some ways to mitigate this, but my question is can we “tune” r4j to “ignore” an unknown classname in the “ignoreExceptions” list so it does not fail on startup?
resilience4j:
circuitbreaker:
global:
ignoreExceptions:
- com.sample.app.SampleException
- com.sample.app.new.SampleException
Many thanks and I hope I was clear on the ask!
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 22 (13 by maintainers)
@cabbonizio Yee, Swagger might be the case because I have developed Swagger2Markup some years ago to document Rest APIs in Asciidoc or Markdown 😃
I completely understand. Please let me know how else I can help.
Thank you for the kind words. The problem is that a fix is not that easy, since it would require a custom Spring Boot Converter. But @charb29 is looking into it.
@cabbonizio, a PR has been opened for the new feature.
@cabbonizio I updated the code, so it should work with
globalconfiguration now as well. Please keep me posted.This is perfect @charb29! Will give it a try
Hi @cabbonizio, I added the feature and believe that it should work for your situation. Could you fork this branch and publish it to your local maven repository to use in your code? It should work.
The tests aren’t fully implemented yet, so when publishing to your local maven repository, use this command:
./gradlew publishToMavenLocal -x testTo use the feature, all you need to do is add the
ignoreUnknownExceptions: truefield in your configuration.It only works for the
defaultconfiguration at the moment, but I am working on making it work for multiple types.@cabbonizio I’ll provide updates along the way, but if you’d like to track the progress, I’ll be working out of this branch.
Sounds good, I’ll start working on it. @cabbonizio
Yep @charb29 that’s exactly what happens
@cabbonizio I’m working on replicating the issue at the moment, so I’m not entirely sure yet how we’ll solve this. However, combining the default behaviour with a flag to try and provide the best of both worlds could be a solution.
After speaking with @RobWin though, it’s a priority that the new feature is backwards compatible.
@cabbonizio no worries. I’ll keep you updated on the progress.