Child pages
  • JAX-RS Failover
Skip to end of metadata
Go to start of metadata

JAX-RS: Failover  

Starting from CXF 2.4.1, CXF JAX-RS clients can be configured for them to become failover-capable.
Core CXF Failover and Load Distribution features are supported.

Failover

Proxies and WebClients can be configured to failover to alternate addresses in case of connection-related failures.
Sequential and Random strategies are supported and implementers can build more sophisticated failover features by retrieving
alternate addresses from locators and other intermediaries.

Spring

Code

Circuit Breakers Failover

The recent addition to CXF failover features is the implementation based on circuit breakers, more precisely Apache Zest (https://zest.apache.org/) library. It is available starting from CXF 3.2.0.

The configuration is very similar to the regular failover strategy, the only difference is usage of clustering:circuit-breaker-failover element.

Spring

Circuit breakers have recommended themselves as a proven strategy to handle and monitor the failures related to external service calls, giving the external systems a time to recover by preventing endless retries or time-outing. For that reason, two configuration parameters could be tuned:

  • threshold: the error threshold to open the circuit breaker
  • timeout: the timeout to wait before trying the next invocation

Code

Load Distribution

CXF Load Distribution feature is a failover feature which can iterate where alternate addresses not only in case of failures but also after a successful invocation has been done.

Example:

the selector can be set from code like this:

  • No labels