conversationId and IPC Portlets
frankr Nov 20, 2006 12:16 PMI have two portlets (PortletA and B) communicating using IPC where B is listening for events coming from A. Both portlets are using the same controller component and this component is set to conversation scope. PortletA contains a bunch of commandLinks that invoke action methods on the controller component and the view outcome is displayed in PortletB.
If I click any commandLink in PortletB, the conversation is correctly maintained, however if I click in PortletA the conversation is lost and a new one is created. The problem with this is that the number of conversations grows with every click which is not the most scalable solution ;-)
The commandLink URL in portletB contains the conversationId=8. When I click this link, the portlet renders correctly back to conversationId=8.
Debug out put confirms this:
... 2006-11-20 23:52:57,396 INFO [test.TestPortlet] conversationId on renderRequest: 8 2006-11-20 23:52:57,396 DEBUG [org.jboss.portal.portlet.container.info.PortletResourceBundleManager] Want to load bundle null for locale en_US 2006-11-20 23:52:57,396 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces} 2006-11-20 23:52:57,396 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePortletPhaseListener] beginning transaction prior to phase: RENDER_RESPONSE(6) 2006-11-20 23:52:57,396 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces} 2006-11-20 23:52:57,396 DEBUG [org.jboss.seam.contexts.Lifecycle] >>> Begin web request 2006-11-20 23:52:57,396 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.manager 2006-11-20 23:52:57,396 DEBUG [org.jboss.seam.core.Manager] Found conversation id in request parameter: 8 2006-11-20 23:52:57,396 DEBUG [org.jboss.seam.core.Manager] Restoring conversation with id: 8 ...
After this the commandLink still contain conversationId=8, however when I click in the command link in PortletA:
... 2006-11-20 23:54:50,528 INFO [test.TestPortlet] conversationId on renderRequest: 19 2006-11-20 23:54:50,528 DEBUG [org.jboss.portal.portlet.container.info.PortletResourceBundleManager] Want to load bundle null for locale en_US 2006-11-20 23:54:50,528 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces} 2006-11-20 23:54:50,528 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePortletPhaseListener] beginning transaction prior to phase: RENDER_RESPONSE(6) 2006-11-20 23:54:50,528 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces} 2006-11-20 23:54:50,528 DEBUG [org.jboss.seam.contexts.Lifecycle] >>> Begin web request 2006-11-20 23:54:50,528 DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.manager 2006-11-20 23:54:50,528 DEBUG [org.jboss.seam.core.Manager] Found conversation id in request parameter: 19 2006-11-20 23:54:50,528 DEBUG [org.jboss.seam.core.Manager] Restoring conversation with id: 19 ... 2006-11-20 23:54:50,549 DEBUG [org.jboss.seam.core.Manager] Storing conversation state: 19 2006-11-20 23:54:50,549 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing page context 2006-11-20 23:54:50,549 DEBUG [org.jboss.seam.core.Manager] Storing conversation state: 19 2006-11-20 23:54:50,549 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing page context ... 2006-11-20 23:54:50,669 DEBUG [org.jboss.seam.core.Manager] Discarding conversation state: 20 2006-11-20 23:54:50,669 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing page context 2006-11-20 23:54:50,669 DEBUG [org.jboss.seam.core.Manager] Discarding conversation state: 20 2006-11-20 23:54:50,669 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing page context ...
If I click the commandLink in PortletA for the second time it jumps two numbers to 21. I'm guessing this is because Seam assigns a temporary conversation by default for each portlet and I have two portlets.
How can I ensure that conversation propagation works properly using IPC? Is there someway I can restore the previous (correct) state in the portlet? Feedback appreciated.