Overview This guide walks through creating two OSGi modules in Liferay 7.4 and sharing a Java package between them using the standard API + Implementation pattern. This is the most common and correct approach for exposing reusable services in a Liferay-based architecture. In OSGi, a bundle (module) does not expose its internal packages by default — everything is private unless explicitly exported. To share code between modules, the standard practice is to split functionality into: · An API module — contains interfaces/DTOs and exports the package · A Service (Implementation) module — implements the interface, imports the package, and registers the implementation as an OSGi component/service The consuming module then simply imports the API package and looks up the service using @Reference injection. Step 1: Create the API Module Using Liferay Workspace + Blade CLI, generate a new API module: blade create -t api -p com.sgc.greeting greeting-api This generates a Gradle module unde...
Liferay DXP Cluster Communication 1. Overview JGroups is a reliable group communication toolkit for Java applications. In Liferay DXP, JGroups manages cluster membership, node discovery, and data replication across cluster nodes. The configuration file shown in this document defines a TCP-based cluster stack, which is the recommended transport for Liferay clusters running on a single machine or across a LAN where UDP multicast is restricted. The configuration is stored in a file typically named tcp.xml and referenced from Liferay's portal-ext.properties: cluster.link.channel.properties.control=tcp.xml cluster.link.channel.properties.transport.0=tcp.xml 2. Complete Configuration File <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst...