Skip to main content

Serverful Architecture

Microservices on a Long-Lived, Multi-Threaded Java Runtime

Overview

Serverful architecture deploys BCE-structured microservices as (uber) jars or regular applications on longer-lived (> 15min), multi-threaded Java runtimes, running on bare metal servers, VMs, or containers with more control over infrastructure and resources.

A well-crafted Serverful application consists solely of pure business logic and the platform (MicroProfile, Jakarta EE or Java SE), with no dependencies on external frameworks or libraries. All top-level packages, also known as business components, are named after business concepts and are consistently structured using the 'boundary control entity' pattern.

Business Components

A Business Component (BC) is a Java package whose name can be understood by product managers and users. BCs provide significant value, which is exposed to external users or systems via the boundary package, and to other BCs via the control and entity packages. A well-sized BC typically hosts a few entities (approximately 1-10) and usually just one Business Facade, keeping components focused and maintainable.

Create classes in the control package when your boundaries become complex or when you need to extract reusable business logic. Control classes should contain methods that focus on a single business task and have transient state. They should also be accessed by boundaries or other controls. Apply the divide-and-conquer principle: if a boundary class is handling multiple concerns or is becoming difficult to understand, refactor the business logic into focused control classes.

Boundary

Create a boundary package as the primary entry point for external clients. Keep boundaries thin and simple by limiting them to input validation, output formatting, and delegation to control or entity layers. Create additional boundaries when you need different external interfaces (REST vs WebSocket) or when cyclomatic complexity exceeds manageable thresholds. Each boundary should expose high-level, transaction-oriented operations that map to specific business capabilities.

Control

Create control classes when you need to extract business logic from boundary classes or implement reusable business operations. Control classes should contain methods with transient state that focus on specific business tasks and coordinate entities and external services. Apply the divide-and-conquer principle: when boundary classes become complex or handle multiple concerns, refactor the business logic into focused control classes that can be accessed by boundaries or other control components.

Entity

Create classes in the entity package to represent core business concepts and persistent data structures. Entities should encapsulate both state and business logic related to the domain objects they represent. Use JPA annotations for persistent entities or create regular Java objects for transient domain models. Complex and domain-motivated records, enums, and POJOs should also be modeled as entities when they represent meaningful business concepts rather than simple technical data structures.

Implementation Characteristics

Scope and Dependency Injection

Transactions

Documentation

Resources

Examples & References

Runtimes