The Microservice API consists of a base class for defining executable microservices.
Features include:
-
A builder-based API for defining and starting microservices.
-
An extensible API that allows you to hook into various lifecycle events.
-
Simple-to-use APIs for accessing manifest file entries, command-line arguments, and external configuration
file properties.
The Microservice API consists of the following packages and classes:
- {@link oaj.microservice}
- {@link oaj.microservice.Microservice} - The base microservice class.
- {@link oaj.microservice.Microservice.Builder} - Builder for the microservice class.
- {@link oaj.microservice.MicroserviceListener} - Interface for hooking into lifecyle events of the microservice.
- {@link oaj.microservice.BasicMicroserviceListener} - Adapter for MicroserviceListener class.
- {@link oaj.microservice.console}
- {@link oaj.microservice.console.ConsoleCommand} - Abstract class for defining console commands.
By itself the Microservice API doesn't provided much functionality but it does provide the basis for the Jetty Microservice described later.
The most-basic creation of a microservice from an entry-point method is shown below:
| public class App {
| public static void main(String[] args) {
| Microservice
| .create() // Create builder.
| .args(args) // Pass in args.
| .build() // Create microservice.
| .start() // Start microservice.
| ;
| }
| }