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 ...

Get Java EE 8 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.