Integrating Microservices
Liferay Self-Hosted Liferay SaaS Liferay PaaS
Liferay 7.4
You can define microservice client extensions to run your own code in response to events in your Liferay instance. How you implement the code is up to you: use the patterns and technologies you like. Microservice client extensions are hosted outside of Liferay and are triggered by cues from Liferay itself.
Microservice client extensions require pre-configured authentication profiles to handle requests properly and call protected Liferay APIs. You can add authentication profiles by including them as client extensions within the same project (e.g., OAuth user agent client extensions).
Microservice client extensions are hosted automatically when deployed within Liferay Cloud. If self-hosting a Liferay instance, you must host the microservices that these client extensions use separately.
Object Action Client Extensions
Object action client extensions define external action handlers that bind to an object definition’s action events. Your microservice’s handler code is executed when the object action occurs.
Use the type
value in your client-extension.yaml
file to specify an object action client extension:
type: objectAction
Object Validation Rule Client Extension
Object Validation Rule client extensions define custom validations that you can add to object definitions. They define external event handlers that bind to object entry submission events and execute when users create or update entries. When creating these client extensions, you can use any number of conditions for determining valid field inputs, but each condition must set and return the validationCriteriaMet
key as either true
or false
. See ObjectValidationRule1RestController
for a basic example.
To use this type of client extension, add the objectValidationRule
type to your client-extension.yaml
file:
type: objectValidationRule
Once deployed, these client extensions appear as options when adding validations to an object definition. See Adding Field Validations for more information.
- Beginning in Liferay DXP 2024.Q3/Portal 7.4 GA125, you can add validation rules for system objects.
- Validation messages for system objects may not be displayed in their native UI. However, the validations run as expected.
You can scope the validation rule to specific object definitions using the allowedObjectDefinitionNames
property. See Object Validation Rule YAML Configuration Reference for more information about the client extension’s properties. When processing the object entry POST request from Liferay, refer to each allowed object definition’s entry schema in the headless API explorer. Find the endpoint of interest and use its Schema browser to understand the entity’s JSON.
Workflow Action Client Extensions
Workflow action client extensions define external workflow action handlers that bind to action events from a Liferay workflow. Your microservice’s handler code is executed when the workflow action occurs.
Use the type
value in your client-extension.yaml
file to specify a workflow action client extension:
type: workflowAction
Notification Type Client Extensions
Notification type client extensions define external notification handlers that bind to notification events in Liferay. Your microservice’s handler code is executed when the notification event occurs.
Use the type
value in your client-extension.yaml
file to specify a notification type client extension:
type: notificationType