DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Writing Java Microservices With MicroProfile 1.3

Writing Java Microservices With MicroProfile 1.3

A microservices architecture is a collection of loosely-coupled services, each representing one unique business function in your application. This approach i...

Kevin Sutter user avatar by
Kevin Sutter
·
May. 21, 19 · Analysis
Like (9)
Save
Tweet
Share
9.93K Views

Join the DZone community and get the full member experience.

Join For Free

Eclipse MicroProfile is a set of vendor-neutral Java extensions for building fault-tolerant, scalable Java microservices. With MicroProfile on Open Liberty, you can build and deploy applications as loosely-coupled services, each representing one unique business function.

What Is a Microservice?

A microservices architecture is a collection of loosely-coupled services, each representing one unique business function in your application. This approach is more modular and makes the application easy to understand, easy to develop, and easy to test. It also enables small, autonomous teams to develop, deploy, and scale their respective services independently.

Why Use a Microservices Architecture?

microservices architecture

Microservices Architecture

A monolithic architecture (left) packages all aspects of the business functionality into a single application. All services are interdependent and deployed as a single unit.

A microservice architecture (right) packages each business function separately as its own service. Each service is independent and developed, tested, and deployed independently.

What Is MicroProfile?

MicroProfile is a vendor-neutral programming model which is designed in the open for developing Java microservices. It provides the core capabilities you need to build fault-tolerant, scalable microservices.

Because MicroProfile is developed in the open and is a collaboration between several partners, it means we can be innovative and fast! MicroProfile is part of the Eclipse Foundation.

The project released three updates to MicroProfile in 2017 and even on more in 2018. Open Liberty is implementing these updates as fast as they are being agreed. The release of Open Liberty, 18.0.0.1, contained a full implementation of MicroProfile 1.3.

What’s in MicroProfile 1.3?

microprofile13

MicroProfile 1.3 contains the following capabilities:

  • Externalize configuration to improve portability (Config 1.2)
  • Monitor a microservice’s telemetry data (Metrics 1.1)
  • Handle unexpected failures in your microservices (Fault Tolerance 1.0)
  • Determine a microservice’s availability (Health Check 1.0)
  • Authentication and role-based access control (JWT Propagation 1.0)
  • Document your RESTful APIs (OpenAPI 1.0)
  • Enable distributed tracing of your microservices (OpenTracing 1.0)
  • Consuming a RESTful web service with type-safe Java (Rest Client 1.0)
  • Build RESTful web services (JAX-RS 2.0, CDI 1.2, JSON-P1.0)

Externalize Configuration to Improve Portability (Config 1.2)

The Config 1.2 component externalizes configuration from the application to improve portability of the application. A core principal is to be able to override configuration at deployment time using system properties and environment variables. Config 1.0 was the key component for the first Eclipse MicroProfile 1.1 release, and has had two iterations since.

The Config technology is also being proposed as the Configuration API 1.0 JSR through the JCP process.

Find out more:

  • Configuring microservices
  • Separating configuration from code in microservices (interactive guide)

Monitor a Microservice’s Telemetry Data (Metrics 1.1)

The Metrics 1.1 component provides common REST endpoints for monitoring a microservice’s telemetry data. Similar in nature to JMX but a much simpler API using JAX-RS. Both built-in and application-defined metrics are accessible, with the output in either JSON or Prometheus text formats. Again, this is a popular feature with one update on the books and more to come. This API provides more extensive detail than the simple up/down reporting provided by the Health Check component.

Find out more:

  • Providing metrics from a microservice

Handle Unexpected Failures in Your Microservices (Fault Tolerance 1.0)

The Fault Tolerance component provides an API and annotations for building robust behavior to cope with unexpected failures in your microservice. Aspects of fault-tolerant execution include timeouts, retries, fallbacks, bulkhead processing, and circuit breakers. This is proving to be one of our most popular features of MicroProfile, and is frequently referenced in conference sessions.

Find out more:

  • Building fault-tolerant microservices
  • Preventing repeated failed calls to microservices (interactive guide)

Determine a Microservice’s Availability (Health Check 1.0)

The Health Check component provides a common REST endpoint format to determine microservice availability. This is a simple check to determine if a microservice is alive or not. Contrast with Metrics, which provides much more detail on the running microservice.

Find out more:

  • Adding health reports to microservices

Authentication and Role-Based Access Control (JWT Propagation 1.0)

The JWT Propagation component provides for interoperable authentication and role-based access control in Java. This MicroProfile feature allows for an authenticated JWT token to be shared across multiple microservices—even if these services are running on other vendors’ implementations. This was one of the first ideas proposed for MicroProfile and we delivered it as part of MicroProfile 1.2.

Find out more:

  • Securing microservices with JSON Web Tokens

Document Your RESTful APIs (OpenAPI 1.0)

The OpenAPI component provides a Java API for the OpenAPI v3 specification that you can use to expose their API documentation. You can natively produce OpenAPI v3 documents from their JAX-RS applications. FYI, the OpenAPI specification started off as the Swagger specification.

Find out more:

  • Documenting RESTful APIs

Enable Distributed Tracing of Your Microservices (OpenTracing 1.0)

The OpenTracing component allows services to easily participate in a distributed tracing environment. The specification defines behaviors and an API for accessing an OpenTracing-compliant Tracer object within your microservice. These trace logs can then be consumed by a third-party distributed tracing facility such as Zipkin or Jaeger.

Find out more:

  • Enabling distributed tracing in microservices

Consuming a RESTful Web Service With Type-Safe Java (REST Client 1.0)

The REST Client component provides a type-safe approach for invoking RESTful services over HTTP. This API greatly simplifies the client-side API as defined by JAX-RS. The underlying MicroProfile implementation also handles the communication between the client and service.

Find out more:

  • Consuming RESTful services with template interfaces

Build RESTful Web Services (JAX-RS 2.0, CDI 1.2, JSON-P1.0)

These three Java EE technologies (JAX-RS, CDI, and JSON-P) provide the base for MicroProfile and were the designated content for MicroProfile 1.0.

Find out more:

  • Creating a RESTful web service
  • Injecting dependencies into microservices

Give it a tTy on Open Liberty

Open Liberty 18.0.0.1 implemented MicroProfile 1.3. Pick a MicroProfile technology that you like the sound of and try its guide to see it in action on Open Liberty. Each of the guides takes from 25 – 50 minutes, depending on your experience level. They are all self-sufficient and you can do them in any order.

microservice Java (programming language) Web Service Role-based access control REST Web Protocols application API

Published at DZone with permission of Kevin Sutter, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • What Are the Different Types of API Testing?
  • Journey to Event Driven, Part 1: Why Event-First Programming Changes Everything
  • Choosing the Right Framework for Your Project
  • Integrate AWS Secrets Manager in Spring Boot Application

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: