Broadleaf Microservices

Service Anatomy

Overview

Broadleaf microservices follow conventions that will help you to quickly locate the components involved in an operation. This helps to locate code that might be similar to something you are trying to do and to find the right component to override or augment for your specific business purposes.

The diagram below depicts the architectural layers found in each Broadleaf microservice.

Service Sequence Diagram

Service Sequence Diagram

Request will pass through these various layers from the presentation-tier to persistence with messaging sometimes being used to communicate asynchronously with other services and systems.

  • The first column (SPA) represents the application making calls to the microservice which is often a Single Page Application but can be any system capable of making API calls.

  • The API layer in Broadleaf is developed as Spring REST controllers with special facilities to allow you to extend the out of box controller logic. Broadleaf endpoints are annotated to enforce the appropriate tenant, application, and context level security concerns. For example, the Product Microservice would include an endpoint that would respond to the URI "/product/123".

  • The endpoints will communicate to service components. The service layer is responsible for housing business logic and mapping DTO "projections" to and from the actual persisted entities.

  • An important concept within Broadleaf is the data mapping pipeline which is used by services to map data between DTOs and the persisted entities. You will also see the DTOs referred to as the "projection domain" and "business domain" throughout the Broadleaf documentation. Broadleaf services and domain make extensive use of the mapping pipeline to facilitate advanced features such as multitenancy, translations, and sandboxing. Your custom services can also utilize these techniques and receive the same benefits.

  • The entity is passed to a SpringDataRepository. All services that persist data support JPARepositories and can be used with PostgreSQL, MariaDB, Oracle, and MySQL. Some services also provide support for Mongo.

  • Broadleaf provides some message interactions using Spring Cloud Stream which can be configured to work with Kafka and GCP as well as other messaging providers.

With Broadleaf, customization is possible at each of these layers.