O'Reilly logo

Java EE 8 High Performance by Romain Manni-Bucau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Failover extension

With CDI, you can define a small extension, which will automatically handle the failover, exactly as we did with streams previously, without much effort. The extension will be composed of two main parts:

  • It will identify all the implementations of a particular logic
  • It will register a bean for chaining the implementations in the right order with the failover logic

To do so, we need a few API elements:

  • To find a service implementation, we will mark an interface method with @Failoverable to identify that we need to create a failover implementation for this interface; we will also use this annotation to mark the implementations.
  • To sort the services, we will use @Priority. We will just use the priority value as a sorting ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required