留言板

IPC using Events in Liferay 6.2 JSF portlets

Jatinderveer Singh,修改在6 年前。

IPC using Events in Liferay 6.2 JSF portlets

New Member 帖子: 11 加入日期: 16-8-4 最近的帖子
Hi I have created the following JSF portlet project for Liferay 6.2 with Tomcat and would need to understand something in IPC using Events.
Here i have created a Sender portlet class "senderManagedBean" and on receiver class "recieverManagedBean" with very straight forward use of passing a serialized pojo from sender to receiver on click of a jsf command button .
Here is the portlet.xml



	<portlet>
		<portlet-name>JSF-IPC-Sender</portlet-name>
		<display-name>JSF IPC Sender</display-name>
		<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
		
		<supported-publishing-event>
			<qname xmlns:x="http://liferay.com/events">x:ipc.param</qname>
		</supported-publishing-event>
	</portlet>
	<portlet>
		<portlet-name>JSF-IPC-Reciever</portlet-name>
		<display-name>JSF IPC Reciever</display-name>
		<portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
		
		<supported-processing-event>
        <qname xmlns:x="http://liferay.com/events">x:ipc.param</qname>
    </supported-processing-event>
	</portlet>
	<event-definition>
		<qname xmlns:x="http://liferay.com/events">x:ipc.param</qname>
		<value-type>ipc.Param</value-type>
	</event-definition>




Now on click of button i am publishing the event and the question is how do i recieve that in my reciever. I have also attached the source code for better understanding.
According to Liferay KB
i do not need to implement a handler but then if i do not implement how do i get the event in receiver and retrieve the values. And how do i know that the object is same.
Novice to Liferay Thanks for the help.
thumbnail
Neil Griffin,修改在6 年前。

RE: IPC using Events in Liferay 6.2 JSF portlets

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
I looked at your source code and one thing I noticed was that jsf-ipc-receiver.xhtml has the "Send" button, and jsf-ipc-sender.xhtml does not. I think it would need to swap the names of those files, since portlet.xml defines the JSF-IPC-Sender portlet to be the one that publishes the event, and JSF-IPC-Receiver to be the one that processes the event. Also, I recommend that you study the source code of our jsf-ipc-events-bookings-portlet and jsf-ipc-events-customers-portlet demos. You can also download binary WAR versions of those portlets to try in your environment.