|
| 1 | +:page-layout: post |
| 2 | +:page-title: Fault Tolerance 6.8.0 |
| 3 | +:page-synopsis: SmallRye Fault Tolerance 6.8.0 released! |
| 4 | +:page-tags: [announcement, microprofile] |
| 5 | +:page-date: 2025-02-04 08:00:00.000 +0100 |
| 6 | +:page-author: lthon |
| 7 | +:smallrye-ft: SmallRye Fault Tolerance |
| 8 | +:microprofile-ft: MicroProfile Fault Tolerance |
| 9 | + |
| 10 | += Fault Tolerance 6.8.0 |
| 11 | + |
| 12 | +Today, we announce the https://github.com/smallrye/smallrye-fault-tolerance/releases/tag/6.8.0[release] of {smallrye-ft} 6.8.0. |
| 13 | +This release contains one new feature. |
| 14 | + |
| 15 | +In link:/blog/fault-tolerance-6-7-0[{smallrye-ft} 6.7.0], we introduced a new programmatic API, together with an annotation to use the programmatically created `Guard` / `TypedGuard` objects declaratively: `@ApplyGuard`. |
| 16 | +In this release, we add support for configuration for `@ApplyGuard` using MicroProfile Config. |
| 17 | +Note that `Guard` and `TypedGuard` themselves still do not support configuration, only `@ApplyGuard` does. |
| 18 | + |
| 19 | +This means that if you want to configure the `Guard`/`TypedGuard` used declaratively via `@ApplyGuard`, you should *NEVER* use those objects programmatically. |
| 20 | +Configuration is applied on creation, which happens lazily, on the first use. |
| 21 | +This first use must be through `@ApplyGuard`, otherwise configuration would be ignored. |
| 22 | + |
| 23 | +Configuration keys are still the same, except you use the `@Identifier` value instead of a `<classname>` or `<classname>/<methodname>`. |
| 24 | + |
| 25 | +For example, let's assume the following `Guard` declaration: |
| 26 | + |
| 27 | +[source,java] |
| 28 | +---- |
| 29 | +@ApplicationScoped |
| 30 | +public class PreconfiguredFaultTolerance { |
| 31 | + @Produces |
| 32 | + @Identifier("my-fault-tolerance") |
| 33 | + public static final Guard GUARD = Guard.create() |
| 34 | + .withRetry().maxRetries(2).done() |
| 35 | + .build(); |
| 36 | +} |
| 37 | +---- |
| 38 | + |
| 39 | +Then, to configure the maximum number of retries, one can use the following configuration keys: |
| 40 | + |
| 41 | +* {smallrye-ft} specific: `smallrye.faulttolerance."my-fault-tolerance".retry.max-retries` |
| 42 | +* specification defined: `my-fault-tolerance/Retry/maxRetries` |
| 43 | + |
| 44 | +Global configuration also applies to `@ApplyGuard`. In this case, the keys are: |
| 45 | + |
| 46 | +* {smallrye-ft} specific: `smallrye.faulttolerance.global.retry.max-retries` |
| 47 | +* specification defined: `Retry/maxRetries` |
| 48 | + |
| 49 | +Enablement configuration also applies. Note however that if the `Guard` or `TypedGuard` is created _without_ certain fault tolerance strategy, no amount of configuration can add it. |
| 50 | +Configuration only applies to strategies that were added in the builder. |
| 51 | + |
| 52 | +As usual, if you have any ideas for improvements, please https://github.com/smallrye/smallrye-fault-tolerance/issues[file an issue]! |
0 commit comments