Liferay Inter Portlet Communication (IPC)

Liferay  Inter Portlet Communication (IPC) is mechanism to communicating one Portlet to other Portlet.
 
JSR 168/ Portlet 1.0 have very limited capability to provide Liferay Inter Portlet Communication (IPC) and its used Portlet Session to share data among Portlets.
 
JSR 286/Portlet 2.0 has added many ways to support Liferay Inter Portlet Communication (IPC) and it provides better approaches than what JSR 168 is already provided.
 
 
 
Liferay Portal will support all types of Inter Portlet Communication (IPC) that JSR 168 and JSR 286 provided.
 
When IPC comes into picture we can have two types of Portlets that is Sender Portlets and Receiver Portlets another way we can say Producer Portlets and Consumer Portlets.
 
Sender/Producer Portlet will send some data that is sharable to other Portlets and 
Consumer/Receiver/Listener Portlets are will receive data which already shared by producer/Sender Portlets. IPC can made with in the page or across the portal
 
Some of IPC mechanism only possible  with in the page means all Portlets should be in the same and some other can support IPC among all Portlets which are in different pages or we can say across portal Portlets.
 
We have following Types of IPC Mechanisms which Liferay portal can support.
 
 
  1. Portlet Sessions IPC
  2. Public Render Parameters IPC
  3. IPC Events
  4. Client Side IPC with AJAX
  5. Client Side IPC with Cookies

 

 
From JSR 168/Portlet 1.0 we have feature of Inter Portlet Communication with Portlet Sessions.
Each Portlet have its own session that is called Portlet Session and session data won’t be shared with other Portlets.
 
To make Inter Portlet Communication with help of Portlet session we will make Portlet session as public so that data will be shared in other Portlets.
 
 
Available from JSR 168 and carried to JSR 286
 
Communication can be possible with in the page and across the portal
 
 
Public Render Parameters are the one of the way to make Inter Portlet Communication among the Portlets and these Portlets may be in same page or different pages in the portal.
 
Public Render Parameters we will define specific parameter in the Portlet with help of that data will be carried from one Portlet to other Portlet and these Public Render Parameters accessible by specific Portlet where we already defined these parameters.
 
IPC we have two categories of Portlets Sender Portlet and Receiver Portlets. Sender Portlet will send some data or push some data then receiver Portlet will receive the data and will process subsequent steps.
 
Available from JSR 286
 
Communication can be possible with in the page and across the portal
 
 
 
IPC Events is one of the ways to make Inter Portlet Communication among the Portlets and these Portlets may be in same page or different pages in the portal.
 
IPC Events we have two categories of Portlets Event Producer Portlet and Event Listener Portlets. Producer Portlet will send some data or push some data then Listener Portlet will receive the data and will process subsequent steps.
 
We can have one Producer and Multiple Consumer Portlet will listen the event and process subsequent steps.
 
Available from JSR 286
 
Communication can be possible with in the page and across the portal
 
 
 
Client Side Inter Portlet Communication is one of the ways in IPC this can apply the Portlet which reside in same page. Because Client side IPC will uses java script to communicate that’s why all Portlet which participated in IPC need to be in same page.
 
Liferay already have some java script library to implement client side IPC in Portlet Development.
Available from JSR 286
 
Communication can be possible with in the page only
 
 
Client Side IPC with Cookies
 
Same Like Client Side IPC with AJAX we can also achieve IPC through browser cookies and data will be stored in cookies and this will be accessed by other portlets and this have some limitation with respect data storage and security wise means I can store very limited data and sometime browsers may disable cookies then communication will be failed among Portlets.
 
Available from JSR 286
 
Communication can be possible with in the page only
 
Suggestible priority order as per my knowledge
 
 
  1. IPC Events
  2. Public Render Parameters IPC
  3. Portlet Sessions IPC 
  4. Client Side IPC with AJAX
  5. Client Side IPC with Cookies
Blogs
Great post, very useful!

Thanks for the very good technical content Meera! I`m a starter developer from an startup of Brazil and the content from your blog helped me many times when i`m developing solutions using Liferay.

Great job! emoticon

hI,

sorry but in Java web site, say:

 

Coordination Between Portlets

To provide coordination between portlets, the Java Portlet Specification, JSR 286, introduces the following mechanisms:

Events: Portlet events that a portlet can receive and send

Public Render Parameters: Render states that can be shared between portlets

 

Client-Side is not  a way of IPC.

 

https://www.oracle.com/technetwork/java/jsr286-141866.html

https://www.oracle.com/technetwork/java/jsr286-3-138810.html#Client-Side_Eventing

 

Why do you say that is a IPC way support in JSR286?

 

Regard!