7.1 Portlet messaging
One of the most significant advantages of the Portlet architecture is the portlets' ability to communicate with each other to create dynamic, interactive applications. Portlets can use messages to share information, notify each other of a user's actions or simply help better manage screen real estate.
Messages can be sent to all portlets on the same page, to a specific named portlet or to all portlets in a single portlet application. To send a message to all portlets on a page, send an instance of the DefaultPortletMessage. Portlets that are deployed as Web services cannot send or receive messages.
In order to make full use of this potential, you need to adequately architect the entire portlet application, anticipating inter-portlet communication. Attempting to implement effective and meaningful message after significant portlet development will cause some difficulty and may require the entire application to be overhauled. This is true for several reasons. For example, access to certain storage objects, such as PortletData, is limited to certain modes. Therefore, if the initial design of an application makes significant use of the PortletData object, implementing messaging later to share configuration information would require a considerable effort. Furthermore, in order to reduce or eliminate code, action event and message event functionality can be combined into a common method. However, to achieve this, it is necessary to consider the information passed via the action or message objects.
First, become familiar with the core objects used in the messaging architecture.
Note: Sharing data between two or more portlets can be accomplished using cooperative portlets. Cooperative portlets subscribe to the WebSphere Portal property broker by publishing properties that they can share. Property Broker should be used instead of messaging.
Prev | Next