|
| 1 | +:page-layout: post |
| 2 | +:page-title: Fault Tolerance 6.7.0 |
| 3 | +:page-synopsis: SmallRye Fault Tolerance 6.7.0 released! |
| 4 | +:page-tags: [announcement, microprofile] |
| 5 | +:page-date: 2024-11-28 14: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.7.0 |
| 11 | + |
| 12 | +Today, we announce the https://github.com/smallrye/smallrye-fault-tolerance/releases/tag/6.7.0[release] of {smallrye-ft} 6.7.0. |
| 13 | +This release contains several big improvements and refactorings. |
| 14 | + |
| 15 | +== Big Internal Refactoring |
| 16 | + |
| 17 | +The internal implementations of all fault tolerance strategies up until now had 2 copies: one synchronous and one asynchronous (based on `CompletionStage`). |
| 18 | +This changes now: all strategies are unified on an asynchronous implementation (based on an internal async type), with a few adjustments for sychronous invocations to support thread interrupts. |
| 19 | + |
| 20 | +This has been done especially for the next feature, which is... |
| 21 | + |
| 22 | +== New Programmatic API |
| 23 | + |
| 24 | +The first version of the programmatic API (`FaultTolerance`, `@ApplyFaultTolerance`) was deprecated and scheduled for removal in {smallrye-ft} 7.0. |
| 25 | +The second version (`Guard`, `TypedGuard`, `@ApplyGuard`) is fairly similar, but has some important differences too. |
| 26 | + |
| 27 | +Comparison of `FaultTolerance`, `Guard` and `TypedGuard`: |
| 28 | + |
| 29 | +[%header,cols="1,1,1"] |
| 30 | +|=== |
| 31 | +|`FaultTolerance` |
| 32 | +|`TypedGuard` |
| 33 | +|`Guard` |
| 34 | + |
| 35 | +|typed |
| 36 | +|typed |
| 37 | +|not typed |
| 38 | + |
| 39 | +|allows fallback |
| 40 | +|allows fallback |
| 41 | +|does _not_ allow fallback |
| 42 | + |
| 43 | +|allows casting, but only if there is no fallback |
| 44 | +|does _not_ allow casting |
| 45 | +|no casting is necessary, target type has to be specified for each call |
| 46 | + |
| 47 | +|does not allow using synchronous `FaultTolerance` to guard asynchonous actions et vice versa |
| 48 | +|does not allow casting |
| 49 | +|allows guarding any type |
| 50 | + |
| 51 | +|created using `create()` or `createAsync()` |
| 52 | +|only `create()`, but it needs the target type (which may be sync or async) |
| 53 | +|only `create()`; the `call()` method needs the target type (which may be sync or async) |
| 54 | +|=== |
| 55 | + |
| 56 | +Comparison of `@ApplyFaultTolerance` and `@ApplyGuard`: |
| 57 | + |
| 58 | +[%header,cols="1,1"] |
| 59 | +|=== |
| 60 | +|`@ApplyFaultTolerance` |
| 61 | +|`@ApplyGuard` |
| 62 | + |
| 63 | +|the `value()` points to a bean of type `FaultTolerance` |
| 64 | +|the `value()` points to a bean of type `Guard` or `TypedGuard` |
| 65 | + |
| 66 | +|ignores all other fault tolerance annotations |
| 67 | +|supports `@Fallback` and thread offload (`@Asynchronous`, `@AsynchronousNonBlocking`) |
| 68 | + |
| 69 | +|does not support Kotlin `suspend` functions |
| 70 | +|supports Kotlin `suspend` functions |
| 71 | +|=== |
| 72 | + |
| 73 | +For more information about migrating to the new programmatic API, see the migration guides: |
| 74 | + |
| 75 | +* link:https://smallrye.io/docs/smallrye-fault-tolerance/6.7.0/reference/programmatic-api.html#migration_from_faulttolerance[Migration from `FaultTolerance`] |
| 76 | +* link:https://smallrye.io/docs/smallrye-fault-tolerance/6.7.0/reference/reusable.html#migration_from_applyfaulttolerance[Migration from `@ApplyFaultTolerance`] |
| 77 | + |
| 78 | +Further, the `MutinyFaultTolerance` API has no replacement. |
| 79 | +The `Guard` and `TypedGuard` APIs support `Uni` out of the box, if the Mutiny support library is present. |
| 80 | + |
| 81 | +== New Configuration Properties |
| 82 | + |
| 83 | +Support for new configuration properties was added. |
| 84 | +The existing, {microprofile-ft}-defined configuration still works, but the new configuration is properly scoped and looks more natural: |
| 85 | + |
| 86 | +[%header,cols="1,1"] |
| 87 | +|=== |
| 88 | +|Existing config property |
| 89 | +|New config property |
| 90 | + |
| 91 | +|`<classname>/<methodname>/<annotation>/<member>` |
| 92 | +| `smallrye.faulttolerance."<classname>/<methodname>".<annotation>.<member>` |
| 93 | + |
| 94 | +|`<classname>/<annotation>/<member>` |
| 95 | +|`smallrye.faulttolerance."<classname>".<annotation>.<member>` |
| 96 | + |
| 97 | +|`<annotation>/<member>` |
| 98 | +|`smallrye.faulttolerance.global.<annotation>.<member>` |
| 99 | + |
| 100 | +|`MP_Fault_Tolerance_NonFallback_Enabled` |
| 101 | +|`smallrye.faulttolerance.enabled` |
| 102 | + |
| 103 | +| `MP_Fault_Tolerance_Metrics_Enabled` |
| 104 | +|`smallrye.faulttolerance.metrics.enabled` |
| 105 | +|=== |
| 106 | + |
| 107 | +All the `<annotation>` and `<member>` parts are changed from camel case |
| 108 | +(`BeforeRetry`, `methodName`) to kebab case (`before-retry`, `method-name`). |
| 109 | +Two annotation members are special cased to improve consistency: |
| 110 | + |
| 111 | +- `Retry/durationUnit` moves to `retry.max-duration-unit` |
| 112 | +- `Retry/jitterDelayUnit` moves to `retry.jitter-unit` |
| 113 | + |
| 114 | +These new configuration properties exist especially for Quarkus, where they will look Quarkus-native: instead of the `smallrye.faulttolerance` prefix, they will start with `quarkus.fault-tolerance`. |
| 115 | + |
| 116 | +== Conclusion |
| 117 | + |
| 118 | +Nothing should change externally, this release should be fully backward compatible. |
| 119 | +But please do pay extra attention. |
| 120 | + |
| 121 | +And as usual, if you have any ideas for improvements, please https://github.com/smallrye/smallrye-fault-tolerance/issues[file an issue]! |
0 commit comments