Annotation Interface HttpServiceFallback
This annotation is used in conjunction with a circuit-breaker mechanism to specify
which fallback class should be used when a service call fails using the
value() attribute.
You can annotate a fallback class with multiple @Fallback annotations to
support different service interfaces or configuration groups.
If group() is specified, the fallback will apply only to
the specified group. Otherwise, it is treated as a default and will be used for all
groups that do not have an explicit per-group fallback configured for the associated
service interfaces. Per-group fallback configurations always take precedence over
default ones.
service() attribute can be used to specify service interfaces that the fallback
class should be used for. If none has been specified, it will be used as a default for
all the services that don't have a per-service configuration specified.
This annotation is repeatable. To declare multiple fallbacks on the same class, simply
annotate it multiple times with @Fallback.
- Since:
- 5.0.0
- Author:
- Olga Maciaszek-Sharma
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceContainer annotation to allow multipleHttpServiceFallbackdeclarations on the same class. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<?> The class that contains fallback methods to be called byCircuitBreakerAdapterDecoratororReactiveCircuitBreakerAdapterDecoratorin case a fallback is triggered. -
Optional Element Summary
Optional Elements
-
Element Details
-
value
Class<?> valueThe class that contains fallback methods to be called byCircuitBreakerAdapterDecoratororReactiveCircuitBreakerAdapterDecoratorin case a fallback is triggered.Both the fallback class and the fallback methods must be public.
-
service
Class<?>[] serviceThe optional list of service interfaces this fallback class applies to.If omitted, the fallback is treated as a default for all service interfaces within the applicable group.
- Returns:
- the service interfaces this fallback applies to
- Default:
{}
-
group
String groupThe optional name of the Http Service Group this fallback applies to.If omitted or blank, the fallback is treated as a default fallback for all groups.
- Returns:
- the group name
- Default:
""
-