Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 2.9 KB

01-intro.md

File metadata and controls

53 lines (39 loc) · 2.9 KB

Introduction

The state-machine has a Service API which provides a simple and robust, state machine based framework for creating a standalone app or microservice. The Service API is shipped with the state-machine library since it is closely coupled to it's implementation, and it is only a lightweight layer on top of it.

Documentation for the Service API can be found in the service section. Here is a quick recap:

  • the Service API requires you to create single responsibility Subsystems (like one responsible for "bootstrapping properties")
  • Subsystems are stored in a List with an implicit order
  • when the app (service) is started, it starts each Subsystem in order
  • when the app is stopped, each Subsystem is stopped in reverse order
  • the service API provides an AppContext where app-level state can be stored

The service-base library builds upon the service API, it contains essential and general functionality which forms the basis of an app. The library is a collection of fundamental Subsystems and tools that make creating a standalone app quick and easy. The design of the Service API is flexible, so the first cut seeded using service-base can be extended and enhanced to any desired level. In short, it's a quick and robust way of building anything from a proof of concept to a full-blown enterprise system.

Subsystems and utilities

The following Subsystems and utilities are avialable.

PropSubsystem - bootstraps properties

The PropSubsystem initializes Property based configuration that can be used throughout an app. Properties are loaded when the Subsystem starts and unloaded when it stops, they can be accessed using PropertyUtil. There are mechanisms for logging, overriding, defaulting and converting properties into useful java constructs.

SupportSubsystem - logs process fundamentals

The SupportSubsystem logs fundamental information about the process, host and JVM. It has a deadlock detection mechanism that logs thread information when deadlocked. Logging this information is useful for 3rd line support. SupportData is also made available statically so it can be used by other parts of an application.

Utilities

Here is a list of the utilities

  • PropertyUtil - for interacting with Property based configuration
  • ArgUtil - helps with parsing process arguments
  • ServiceUtil - utilities for simplifying how an app is bootstrapped

TODO