Introduction
The enterprise ecosystem currently adopts microservices as its default operating format as a standard instead of being a modern trend. Businesses are increasing their preference for components that scale effectively and work independently alongside their ability to deploy untethered because technical innovation and debt reduction drive their transformation. Liferay developed Microservice Client Extensions (CEs) as its most forward-thinking integration feature that allows the platform to connect to external services.
Prerequisites
Liferay DXP/Portal 7.4
Basic knowledge of Liferay
Experience in developing and deploying Liferay modules as well as client extensions
What is Microservice Client Extension?
Through a declarative Microservice Client Extension, Liferay understands how to connect with external microservices for treating them as platform-level extensions. Liferay allows you to configure external API and service consumption through Microservice Client Extensions, which direct the platform on how to authenticate, access endpoints, and use them within specific contexts.
Key Features of Microservice Client Extensions
Loose Coupling : The APIs used by these modules exist only outside the Liferay internal structure. The extensions explain the necessary method for interacting with external microservices through HTTP(S).
Language-Agnostic : A microservice from your system can utilize any programming language from Java to Python or Node.js, or Go, since Liferay operates without any specific concerns about language selection. Exposure of an HTTP API enables acceptance by Liferay.
Configurable Authentication : Microservice CEs offer a production-ready feature through their ability to support various authentication schemes, which include no-auth as well as API keys and OAuth2.
Scalable and Cloud-Friendly : These extensions operate independently of the portal runtime, which enables independent scaling while allowing deployment in Docker/Kubernetes as well as monitoring like standard modern applications.
Types of Supported Client Extensions
- OAuth User Agent YAML Configuration Reference : Through this step, the authorization channel displays microservice payload content to the currently logged-in user within the custom element.
ignek-spring-boot-oauth-application-user-agent:
.serviceAddress: localhost:58081
.serviceScheme: http
name: Ignek Spring Boot OAuth Application User Agent
scopes:
- Liferay.Headless.Admin.User.everything
- Liferay.Headless.Admin.Workflow.everything
type: oAuthApplicationUserAgent
- Object Action YAML Configuration Reference : Liferay Objects execute Object Actions throughout either creation, modification, or standalone types. The framework enables microservices to embed program logic where they can use third-party APIs and modify connected data.
ignek-spring-boot-object-action-1:
name: Ignek Spring Boot Object Action 1
oAuth2ApplicationExternalReferenceCode: ignek-spring-boot-oauth-application-user-agent
resourcePath: /object/action/1
type: objectAction
- Workflow Action YAML Configuration Reference : You can use the Workflow Action YAML Configuration Reference to add custom logic to Liferay’s Kaleo workflows (including approval processes).
liferay-sample-etc-spring-boot-workflow-action-1:
name: Liferay Sample Etc Spring Boot Workflow Action 1
oAuth2ApplicationExternalReferenceCode: liferay-sample-etc-spring-boot-oauth-application-user-agent
resourcePath: /workflow/action/1
type: workflowAction
- Notification Type YAML Configuration Reference : The system enables users to build their own notification delivery methods for Liferay Notifications that can use email and SMS, as well as third-party applications or webhooks. Liferay Notifications deliver messages either by email, SMS, or third-party applications and custom webhooks.
liferay-sample-etc-spring-boot-notification-type-1:
name: Liferay Sample Etc Spring Boot Notification Type 1
oAuth2ApplicationExternalReferenceCode: liferay-sample-etc-spring-boot-oauth-application-user-agent
resourcePath: /notification/type/1
type: notificationType
- Object Validation Rule YAML Configuration Reference : Validates custom object data before saving. This supports complex validation logic that exceeds what’s possible with simple regular expressions or built-in validators.
liferay-sample-etc-spring-boot-object-validation-rule-1:
allowedObjectDefinitionNames:
- C_Employee
name: Liferay Sample Etc Spring Boot Spring Boot Object Validation Rule 1
oAuth2ApplicationExternalReferenceCode: liferay-sample-etc-spring-boot-oauth-application-user-agent
resourcePath: /object/validation/rule/1
type: objectValidationRule
Architecture Overview: How Microservice CETs Integrate with Liferay
The Spring Boot microservice integration with Liferay through Microservice Client Extensions operates with loose dependency and secure and modular functionality. The core element of this structure consists of the OAuth2 Application User Agent that supports authorized one-to-one communication between Liferay and external microservice users.
Flow of Interaction
User Triggers an Action in Liferay
A Liferay UI operation performed by a user includes form submissions and workflow steps, and creating new object entries.Liferay Triggers a CE Endpoint
The system selects an appropriate Client Extension based on the defined resourcePath and CE type parameters that exist in the YAML configuration. The external Spring Boot service receives an HTTP request from Liferay.OAuth2 Authorization
The request contains an access token based on JWT specification, which originated from an OAuth2 User Agent Application. The microservice operates under the authority of the authenticated user at that moment.Spring Boot Microservice Processes the Request
The endpoint in the @RestController receives the request before validating JWT tokens through Spring Security and executing business logic for the current domain.- Response Returned to Liferay
The microservice responds with data that Liferay needs to process the ongoing user action or workflow.
Conclusion
The Liferay platform achieves extended platform scalability and security through its Microservice Client Extensions integration method while retaining the core platform intact. Business logic combined with validations and workflow steps becomes possible through Microservice CEs, which supply Liferay with the flexibility needed to scale for enterprise complexity. Mastering Liferay Client Extension Development supplies detailed information on developing client extension systems.