I attended the Liferay East Coast Symposium this week and got some questions about doing inter portlet communication in Liferay and especially for the case where you have multiple Vaadin portlets on the same page and want to send events between them. The IPC standard in Portlet 2.0 is not that nice as it requires a reload of the page to send the event.
Now in Liferay there is a javascript API which you can use (client side) to send events between portlets. I had some discussions about this with various people and ended up writing an add-on that uses this API on the flight back home. The add-on, now available in Vaadin Directory, provides you with a component: LiferayIPC that can be used for for sending an receiving these Liferay events. It enables you to do IPC between portlets on the same page without the need for using a push add-on or refreshing the page. Of course, it can also be used to communicate with non-Vaadin portlets (or Liferay gadgets) using the same API.
The data sent with an event (restricted to a String) is communicated on the client side (as the Liferay API requires) but if this is a problem it should be possible to only send a reference to something as the payload and then do a lookup of the real data in the receiving portlet on the server side.
The source for the add-on is available on GitHub
. There is also a simple demo with two portlets that use the mechanism to communicate for adding items (fields in one portlet) to a table (in the other portlet). The
full source for the demo
aswell as
a demo war
are also available on GitHub.
Sadly, I have no live demo up at the moment.