BT

Eclipse MicroProfile 1.3 Is Now Available

| by Kesha Williams Follow 4 Followers on Feb 16, 2018. Estimated reading time: 3 minutes |

Eclipse MicroProfile extends Java EE to better address microservices by providing an open-source community specification for enterprise Java microservices. Release 1.3 introduces the OpenAPI, OpenTracing, and Rest Client APIs, and updates the Config and Metrics APIs.   

 

MicroProfile OpenAPI 1.0

As the number of microservices in a Microservices Architecture (MSA) increase, management of the microservices can become unwieldy. A new feature found in the 1.3 release, OpenAPI, allows microservices to be easily managed by Application Programming Interface (API) management solutions. Based on Swagger Core, OpenAPI adheres to the Open API Specification defining a standard, programming language-agnostic interface description that developers can use to expose their API documentation. The resulting interface description is known as the OpenAPI document. There are many different ways to augment an application to provide input for the generation of the OpenAPI document:

A Filter can be used to update an OpenAPI document that has been built using the previously described documentation mechanisms.

 

MicroProfile OpenTracing 1.0

In an MSA, distributed tracing is important because it allows developers to visualise the flow of a request across service boundaries. OpenTracing, another new feature in the 1.3 release, supports distributed tracing by defining behaviors and allowing developers to make distributed tracing decisions at the operational environment level instead of at development time. The OpenTracing API allows for accessing a Tracer object within an application. The Tracer object allows developers to extract needed information from incoming requests and add needed information to outgoing requests.

There are two operation modes for the distributed tracing:

  • Without instrumentation of application code
  • With explicit code instrumentation

When operating without instrumentation of application code, developers are not required to add any distributed tracing code to the source code of their applications, nor are they required to know about the type of environment the application will be deployed to. As long as the outgoing request occurs in the same thread as the incoming request, the relationships are handled automatically.

When operating with explicit code instrumentation, the @Thread annotation is used to specify a class or method to be traced. The configured Tracer object is available to the application with Contexts and Dependency Injection (CDI), allowing developers to add more complex tracing requirements to applications. 

 

MicroProfile Rest Client API 1.0

Another new feature in the 1.3 release, Rest Client API, provides a type-safe approach to invoke RESTful services over HTTP. For example, an interface could be defined for a remote service that allows the scoring of stocks like so:

@Path("/stocks")
public interface StockScoringService {
    @POST
    @Path("/{stockId}/score")
    Integer submitScore(@PathParam("stockId") Integer stockId, Score score );
}

This interface can then be used to invoke the actual remote stock scoring service as follows:

String apiUrl = "http://localhost:9080/stockScoringService";
StockScoringService stockSvc =   
    RestClientBuilder.newBuilder()
            .baseUrl(apiUrl)
            .build(StockScoringService.class);

Integer stockId = 4;
Score score = new Score(10,"Great performing stock.");

stockSvc.submitScore(stockId, score);

The use of Rest Client API supports a more natural coding style and automatically handles the HTTP connectivity and serialization.

 

MicroProfile Config 1.2

Particularly important for microservices running within a cloud environment is the need to change configuration information while the application is running, and have those changes go into effect without a restart. Config 1.2 allows changes to configured values to be picked up immediately upon a change. The latest features provide support for an array converter, a class converter, and an implicit converter for classes where there is no corresponding type of converters provided for a given class.

 

MicroProfile Metrics 1.1

Monitoring system parameters ensure that software is operating reliably. Metrics add monitoring endpoints and metrics to a given process. Unlike simple Health Checks, Metrics provide a deeper look at how well a piece of software is operating by allowing for baseline, application, and vendor-specific metrics. The latest features provide an improved Test Compatibility Kit (TCK), the ability to provide global tags via a config file, and a flag on annotations and metadata indicating when metric names can be registered more than once.

To get started with MicroProfile 1.3, add the following dependency to your pom.xml:

<dependency>
      <groupId>org.eclipse.microprofile</groupId>
      <artifactId>microprofile</artifactId>
      <version>1.3</version>
      <type>pom</type>
</dependency>

More details can be found in the release notes for MicroProfile 1.3. Readers can also keep up to date with all Java-related news by visiting the InfoQ Java homepage.
 

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT