smallrye / smallrye-fault-tolerance

SmallRye implementation of MicroProfile Fault Tolerance: bulkheads, circuit breakers, fallbacks, rate limits, retries, timeouts, and more
Apache License 2.0
86 stars 36 forks source link

static resolution of fallback / before-retry methods #1055

Open Ladicek opened 2 days ago

Ladicek commented 2 days ago

Currently, fallback / before-retry methods (@Fallback.fallbackMethod, @BeforeRetry.methodName) are resolved dynamically, at the same time the other configuration is resolved. This is too late for native image compilation in Quarkus -- we need to know the full reflection configuration during build.

Therefore, this configuration must be resolved "statically". For the CDI portable extension (fully runtime behavior), this means during fault tolerance method discovery. For Quarkus, this means in the Quarkus extension. This will require porting the reflective code to discover methods to Jandex, which is something we'll just have to live with.

Ladicek commented 2 days ago

This will also mean that the configuration for @Fallback.fallbackMethod and @BeforeRetry.methodName will become build-time only in Quarkus. This is contrary to all other FT configuration, which is runtime. I guess there's no other way -- if we want to support native image properly, we have to resolve the config at build-time.