The Payara Platform 5.192 release comes with an update to MicroProfile. Compared to MicroProfile 2.1, four components were updated in MicroProfile 2.2:
- FaultTolerance 2.0 (prior 1.1)
- RestClient 1.2.0 (prior 1.1)
- OpenTracing 1.3 (prior 1.2)
- OpenAPI 1.1.1 (prior 1.0)
More Detailed Fault Tolerance Semantics
The semantics of how multiple fault tolerance annotations interact with each other have been further clarified and defined in greater detail in version 2.0 leading to implementation changes. In summary: All annotations can be used individually or can be combined with any other. The semantic nesting is (outer to inner):
Dynamic Configuration Validation
In addition to fault tolerance annotation validation performed on application deployment overrides done at runtime via properties are also validated. In Payara Platform, fault tolerance configurations are now cached and may take up to a minute before changes become effective. Invalid configurations are rejected and lead to normal execution of the method until the configuration is corrected.
Configurable Alternative @Asynchronous Annotations
A new Payara Platform specific feature allows to set one or more annotations that should mark asynchronous methods in the same way methods annotated with FT's own
@Asychronous annotation are. The alternative annotations are set as comma separate list of their fully qualified class names for the property
MP_Fault_Tolerance_Alternative_Asynchronous_Annotations. Any annotation accessible at runtime can be used. We decided to add this feature since asynchronous execution as cross-cutting concern has been part of other commonly used standards, libraries and frameworks which sometimes define a comparable annotation.
Configurable Interceptor Priority
mp.fault.tolerance.interceptor.priority can now be used to override the base priority for the fault tolerance interceptor(s). It applies to all fault tolerance annotations likewise as all of them are handled by a single interceptor. This includes the alternative annotations mentioned above.
Support for PATCH Method
In version 1.1 of OpenAPI the
javax.ws.rs.PATCH annotation now can be used to mark methods responding to a HTTP
PATCH method request.
A More Flexible and Type-Safe OpenAPI Model
A variety of methods were added to the OpenAPI model to compose documents in a more flexible and type-safe way. For model objects that also are maps the generic
Map methods like
contains were deprecated in favour of new type-safe methods
has<Item> which use a typed key instead of the
Object key parameter typical for methods of
Map. Overall the model was developed more towards composition over inheritance. Now deprecated methods originating from the inheritance paradigm might be removed in future releases.
Improved HTTP Header Support for Rest Clients
Payara Platform implements the 1.2.0 version of RestClient based on the Jersey. Now the new
@ClientHeaderParam annotation can be used on client interface methods specifying
value of headers not defined by the called endpoint interface method. To dynamically compute the value of the
value attribute the attribute can refer to a default or accessible static method by its name in curly braces:
New API to Customise Rest Clients
To provide common REST clients settings or custom behaviour a
RestClientListener can be configured using the
ServiceLocator mechanism. Its
onNewClient method is called with the client interface and
RestClientBuilder instance allowing general customisation of REST clients.
Context Provides Invoked Rest Client Method
ClientRequestContext passed to both
ClientResponseFilter implementations now provides the
java.lang.reflect.Method instance currently being invoked when looked up using
@Traced for Rest Client Methods
Last but not least, the new version of OpenTracing allows using the
@Traced annotation on REST client interface methods.
Join and participate in the community:
Download the new release: