Skip to main content

Microservice Core Overview

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:

Microservice APIorg.apache.juneau.microservice - Main packageMicroservice - The base microservice class.Microservice.Builder - Builder for the microservice class.MicroserviceListener - Interface for hooking into lifecyle events of the microservice.BasicMicroserviceListener - Adapter for MicroserviceListener class.org.apache.juneau.microservice.console - Console packageConsoleCommand - 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.
;
}
}