Offered By: IBM
Consuming RESTful Java microservices with template interfaces using Eclipse MicroProfile Rest Client
Learn how to use MicroProfile Rest Client to invoke RESTful microservices over HTTP in a type-safe way.
Continue readingGuided Project
Open Liberty
64 EnrolledAt a Glance
Learn how to use MicroProfile Rest Client to invoke RESTful microservices over HTTP in a type-safe way.
The application that you will be working with is an inventory service, which fetches and stores the system property information for different hosts. Whenever a request is made to retrieve the system properties of a particular host, the inventory service will create a client to invoke the system service on that host. The system service simulates a remote service in the application.
You will instantiate the client and use it in the inventory service. You can choose from two different approaches, Context and Dependency Injection (CDI) with the help of MicroProfile Config or the RestClientBuilder method. In this guide, you will explore both methods to handle scenarios for providing a valid base URL.
- When the base URL of the remote service is static and known, define the default base URL in the configuration file. Inject the client with a CDI method.
- When the base URL is not yet known and needs to be determined during the run time, set the base URL as a variable. Build the client with the more verbose RestClientBuilder method.
Created by
Estimated Effort
20 Minutes
Level
Intermediate
Skills You Will Learn
Java
Language
English
Course Code
GPXX0XV3EN