Helidon Documentation
repository·main·Indexed 26 days ago
https://github.com/helidon-io/helidonA collection of Java libraries for building microservices, leveraging Java 21 Virtual Threads for a thread-per-request programming model with reactive-level throughput. Includes documentation on Helidon Builder for code generation using blueprints and prototypes, archetype build and test processes, and API stability levels (Stable, Preview, Incubating, Internal).
What's inside Helidon
- Helidon Discovery provides support for acquiring transient resources, such as URIs in a microservices environment, that correspond to a specific discovery name. The API and specification are designed to abstract away specific vendor implementations and underlying discovery mechanisms.
Overview of Helidon SE Observability
mainIn Helidon 4, all observability features are consolidated into a single logical module:observe. This module groups all observability endpoints (such as health checks, metrics, and info) under a single context root. By default, this root is/observe.Overview of Helidon Declarative Code Generation
mainThedeclarative/codegenmodule is the central location for all code generation logic specific to Helidon Declarative. Unlike standard production modules that follow a flat package structure, this module utilizes multiple packages to separate the code generation logic for different Helidon features. This design is possible because the module does not introduce significant implementation dependencies.Overview of Helidon Microservices
mainHelidon is a set of Java libraries designed for writing microservices.
Key features of Helidon 4 include:
- Níma WebServer: A high-performance web server built from the ground up for Java 21 Virtual Threads.
- Thread-per-request style: Provides high throughput (similar to reactive servers) while maintaining the simplicity of blocking, thread-per-request programming.
- Simplified SE API: In Helidon 4, the Helidon SE API has transitioned from asynchronous to blocking to leverage virtual threads, making code easier to write, maintain, and debug.
Overview of Helidon DB Client
mainThe Helidon DB Client provides a unified API for data access and querying. It acts as a layer above JDBC or the MongoDB Java Driver, allowing support for any relational database with a JDBC driver or MongoDB.
Key features include:
- Unified API: Consistent interface for different database types.
- Observability: Built-in support for health checks, metrics, and tracing.
- Portability: By defining native database statements in configuration files rather than hardcoding them, you can switch between different relational database drivers by only changing the configuration.
Overview of Helidon Declarative
mainHelidon Declarative is a declarative programming model for Helidon SE. It allows developers to declare intention by annotating elements, reducing the amount of manual programming required for common microservice tasks.
Key principles:
- Uses a "nested" annotation approach (e.g.,
@Http.Path). - Relies on code generation instead of reflection to minimize runtime overhead and lookups.
- All features are configured through the service registry.
- Features are organized into namespace classes (e.g.,
Http,Ftfor Fault Tolerance,Securedfor Security).
- Uses a "nested" annotation approach (e.g.,
Overview of Helidon OpenAPI Generators
mainHelidon provides two specialized generators via the OpenAPI Generator tool to create code that integrates smoothly with Helidon applications:
- Helidon Client Generator (
java-helidon-client): Creates a Helidon SE client based on Helidon WebClients. It provides an abstraction similar to Remote Procedure Calls (RPC), allowing you to call remote service endpoints by invoking local methods with POJO business objects or Java types. - Helidon Server Generator (
java-helidon-server): Creates server endpoint stubs. You implement the business logic by extending a generated class or implementing a generated interface, reducing the need for resource boilerplate.
For Helidon SE, use the
selibrary with each generator.- Helidon Client Generator (
Overview of Helidon Security features
mainHelidon Security provides the following core capabilities:
- Authentication: Authenticates incoming requests and creates a security
Subjectcontaining aPrincipal(representing the user or service) andGrants(representing roles or scopes). Supported default principals includeUserPrincipalandServicePrincipal. - Authorization: Supports Attribute-Based Access Control (ABAC) and Role-Based Access Control (RBAC). RBAC can be implemented using the
@RolesAllowedannotation in supported integrations. - Outbound Security: Propagates identity or secures outbound requests via the
OutboundSecurityProviderSPI. - Audit: Audits security events (authentication, authorization, outbound) through the
AuditProviderSPI. By default, it logs to a Java Util Logging (JUL) logger namedAUDIT.
- Authentication: Authenticates incoming requests and creates a security
Overview of Concurrency Limits in Helidon
mainThe
concurrency-limitsmodule allows you to restrict the number of concurrent, in-progress operations (e.g., within aWebServer). Helidon provides three primary implementation types that can be selected via configuration:fixed: A semaphore-based limit that supports queuing.aimd: An Additive-Increase/Multiplicative-Decrease limit based on TCP congestion control algorithms, providing variable concurrency limits between a fixed minimum and maximum.throughput: A rate-based limit that throttles requests to a specific amount over a defined duration, also supporting queuing.
Overview of Helidon Data Codegen
mainHelidon Data Codegen provides a framework for generating repository and persistence-related code. It is divided into two main functional areas:
- Common Codegen: Contains the foundational logic for code generation, including base generators for persistence, repositories, and repository interfaces, as well as blueprints for method parameters and repository information.
- Helidon Data Codegen: Provides specialized generators for Helidon Data, including CRUD repository interfaces, JPQL query methods, and name-based query methods.
Overview of Helidon Codegen environments
mainHelidon uses three primary environments for code processing and generation:
- Annotation processors: Preferred method for source code generation and processing.
- Classpath scanning: Used for analyzing external libraries or arbitrary code (e.g., via Maven plugins or CLI tools).
- Reflection: Limited to specific modules intentionally designed for reflection, such as the Config object mapping module.
Helidon prioritizes annotation processing and source code generation whenever possible.
Overview of Helidon SE Components
mainHelidon SE is a foundational set of APIs for microservices. As of Helidon 4, it leverages Java 21 virtual threads, allowing APIs to transition from asynchronous to a blocking programming model. This enables developers to perform blocking operations in a simple synchronous way without starving platform threads.
Key components include:
- WebServer: A programmatic HTTP API designed for high concurrency using virtual threads.
- WebClient: An HTTP client for handling responses to HTTP requests.
- Config: A flexible configuration framework supporting multiple sources and formats.
- Security: A tool-chain for authentication, authorization, and context propagation.
- DB Client: A unified API for database interactions.
- gRPC: Support for building gRPC servers and clients.
- GraphQL: Support for building GraphQL servers.
- WebSocket: Support for WebSocket interactions as both server and client.
- Observability: Includes Metrics for instrumentation, Tracing for profiling across services, and Health Checks for exposing application status.
- Other features: CORS support, JSON Schema creation, Reactive Streams APIs, OpenAPI support, and Dependency Injection.