Liferay IPC add-on

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.

Thanks Artur!

Nice thanks !

The add-on does’nt work with me.
When deployed in liferay, I get the message:

Widgetset does not contain implementation for org.vaadin.artur.liferayipc.LiferayIPC. 
Check its @ClientWidget mapping, widgetsets GWT module description file and re-compile your widgetset.
In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.
Unrendered UIDL: org.vaadin.artur.liferayipc.LiferayIPC(NO CLIENT IMPLEMENTATION FOUND)

The annotation is present in the Liferayipc-class and I have recompiled the widgetset.
Could anybody help me with this ?

How did you recompile the widgetset? With the
Vaadin Control Panel for Liferay
? In Eclipse? Using the correct Vaadin version (on the portal)?

I suspect that either the widgetset is not deployed correctly or your portal/portlet is configured to use another widgetset, but first check the widgetset compilation logs to see if this add-on was included.

I got it working.

thanks

Is it possible to communicate between Applications in different wars?
are there components you have to put on the server, so they can share the components.

I’m not sure if I understood your second question correctly, but trying to answer:

This add-on uses client side communication, so it just depends on the portlets being on the same page and supporting the same messaging protocol - they can be from different WARs.

However, if you want to share data objects on the server side (other than the string passed between portlets via the browser), you have to implement a mechanism to do so - whether using a shared session if the portlets are in the same WAR, message passing or whatever other method is appropriate in your case. This add-on does not provide anything for that part but leaves it up to the user.

Ok, I’m trying this out, and I’m getting the same result as you were reporting. what was the solution please? for what it’s worth, I do not see, in the portlet.xml, any init param regarding the widgetset to be used.

for what it’s worth, I am using Liferay 6.0 GA4, and have updated the vaadin.jar within the liferay-portal WEB-INF/lib with the 6.6.2 version, and have used the vaadin control panel for liferay to rebuild the widgetset after also having added the ipc jar file to the same WEB-INF/lib directory, and checked the jar reference within the control panel.

from what I gather, it seems that the classloader for the portlets is actually that of the portal’s, so by having things there once, all portlets see / have access to whatever is there.

right?

I do see in the add-in (LiferayIPC) jar file, a web.xml that has an init-param for widgetset.

I do not see in the demo portlet anything in the web.xml or portlet.xml that relates to the widgetset.

please advise.

Peter,

I have the same issue that you have. Have you got any answer back? Please keep me informed too. Thanks.

-Mike

Hi, Dieter,

I got the exact error message when i try to run the sender and receiver using LiferayIPC add-on. How do you solve the problem? I will appreciate if you can share your solution.

-Mike

ok. I did get this to work.

what I did though was update the vaadin.jar in the app server with the latest from the vaadin.com web site, and use the control panel portal to build the widgetset, and then manually created the two portlets (in the one web application) using Netbeans and the obtainable source code, with the same version of the vaadin jar being used in the netbeans project.

I will have to review it though to make sure I have described everything correctly…

getting the vaadin version matching for both the compilation of the widgets and the portlets is ‘all important’, as the prebuild portlet sample was built with version x, and trying to run against version y doesn’t work too well - especially when there are differences in the gwt code revision numbers involved between the two versions of vaadin.

I have to say though, that getting absolutely no help whatsoever from this forum does nothing to make me think that vaadin is a great way to develop code. after all, if you can’t get help sorting out this kind of issue from the list, what sort of help am I going to get when it’s a more difficult problem? it does not bode well, I’m afraid.

having gotten it to work, it does work quite well, but I still have reservations about the lack of support.

for those that do regularly provide support on these forums, yeah, I know this may seem very negative and unappreciative, but, that was my experience.

I can only hope for a better experience in future.

to those that make plugins available for the likes of me, I am truely appreciative, and hope that more will be done to make using provided code easy to rebuild using the latest versions of vaadin, as it does seem that the latest vaadin jar can get ahead and out of step with the code that’s available. if there were a build farm used to keep them all in sync, that would be a very nice improvement.

Had some trouble getting it working, but I’ve got the demo working now.

Had to update tomcat/root/web-inf/lib vaadin jar to 6.6+ and also drop in the Liferay IPC jar here, too. Then in Liferay Control Panel → Vaadin, the IPC widget set flag showed up and I was able to recompile the widget set to include it.

I also had to add the Liferay IPC jar to the demo war’s web-inf/lib before it would work!

Does anyone have a quick and easy suggestion for how to make a proof of concept application using Liferay (using bundled Tomcat 6), Vaadin, this IPC addon, and a non-String message communicated from one portlet to another? Is there a Liferay/Tomcat mechanism built in (or easily added) that would allow for, say, message passing or something similar to accomplish this?