gRPC Service
Usage
Render from P6M
Catalog
archetect
P6M -> Java-> Java gRPC Service
Render from GitHub Repo
archetect render git@github.com:p6m-archetypes/java-spring-boot-grpc-service-archetype.git
For information about interacting with the service, refer to the README at the generated project's root.
Prompts
When rendering the archetype, you'll be prompted for the following values:
Property | Description | Example |
---|---|---|
org-name | Organization Name | afi, cpd, a1p |
solution-name | Solution Name | apps, xyz |
prefix | General name that represents the service domain that is used to set the entity, service, and RPC stub names | invoice, order, booking |
suffix | Used in conjunction with prefix to set package names | Service, Adaptor, Orchestrator |
persistence | Defines persistence. What database solution to use | None, CockroachDB |
What's Inside
This archetype is based on the SpringBoot framework and uses Maven as its build system.
Features include:
- Out-of-the box endpoints, including
/health
,/info
,/metrics
,/env
,/liquibase
, and/threaddump
. - Hibernate for ORM
- Liquibase for changeset management
- Simple CRUD over gRPC
- gRPC stub publication based on the project name
- Example GitLab CI configuration
- Docker image publication to artifactory
- Application configuration through property files, environment variables, and CLI arguments.
- Integration with Tilt to support local k8s development
- Out-of-the-box Postgres and LocalStack using Test Containers
Modules
Directory | Description |
---|---|
{project-name}-api | Service Interfaces with a gRPC model. |
{project-name}-bom | Bill of Materials. |
{project-name}-client | gRPC Client. Implements the API. |
{project-name}-core | Business Logic. Abstracts Persistence, defines Transaction Boundaries. Implements the API. |
{project-name}-grpc | gRPC/Protobuf spec. |
{project-name}-integration-tests | Leverages the Client to test the Server and it's dependencies. |
{project-name}-persistence | Persistence Entities and Data Repositories. Wrapped by Core. |
{project-name}-server | Transport/Protocol Host. Wraps Core. |
Key Dependencies
Name | Scope | Description |
---|---|---|
gRPC Spring Boot Starter | API/Remoting | Auto-configures an embedded gRPC server integrated with Spring Boot |
Spring Data JPA | Persistence | ORM. |
AssertJ | Unit Tests | Fluent test assertions. |
Mockito | Unit Tests | Provides mocking and spying functionality. |
TestContainers | Unit Tests, Containers | Programmatic container management. |
LocalStack | Provides Docker images for common AWS services. |