Annotation Interface HttpServiceFallback


@Target(TYPE) @Retention(RUNTIME) @Documented @Repeatable(HttpServiceFallback.Container.class) public @interface HttpServiceFallback
Annotation used to declare a fallback implementation for one or more HTTP service interfaces.

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 Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Container annotation to allow multiple HttpServiceFallback declarations on the same class.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The class that contains fallback methods to be called by CircuitBreakerAdapterDecorator or ReactiveCircuitBreakerAdapterDecorator in case a fallback is triggered.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The optional name of the Http Service Group this fallback applies to.
    Class<?>[]
    The optional list of service interfaces this fallback class applies to.
  • Element Details

    • value

      Class<?> value
      The class that contains fallback methods to be called by CircuitBreakerAdapterDecorator or ReactiveCircuitBreakerAdapterDecorator in case a fallback is triggered.

      Both the fallback class and the fallback methods must be public.

    • service

      Class<?>[] service
      The 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 group
      The 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:
      ""