2 Replies Latest reply on Nov 12, 2009 4:34 AM by chammp

    a4j:poll interfering with navigation

      Hello there

      In our application we use Spring Web Flow as a navigation framework (thus the problem could be caused by SWF - frankly, I don't know for sure) and RichFaces 3.3.1
      There's one area where the user is informed about the state of lengthy background processes. The updates of that area are performed by ajax requests through an a4j:poll. The menu used for navigation consists of rich:dropDownMenus and rich:menuItems (usually using submitMode="server").

      The problem is that when the user selects a menu item and the navigation starts and it takes a longer-than-usual-time to fulfill that request (lengthy DB-operation, high server load, ...) and during that time the ajax-poll occours, then navigation simply is cancelled and the user stays on the page he was before.

      As I said I am not sure if this is more on RichFaces's side or SWF's side. SWF uses a post-redirect-render phase model, so the problem (don't know if it qualifies as a bug or if it's "by design") might acually be there.
      But perhaps anyone had such a problem already and found a workaround?

      The only solution would be to greatly increase the poll-time so that fewer ajax events occur.

      By the way, the code somehow looks like this:

      <a4j:region>
       <h:form>
       <a4j:poll id="poll_id"
       interval="#{someBean.pollInterval}"
       reRender="poll_panel,poll_id"
       ajaxSingle="true" limitToList="true"
       eventsQueue="poll_event_queue" />
       </h:form>
      </a4j:region>
      
      <h:form id="some_form">
       <h:panelGroup id="poll_panel">
       ... stuff that displays the internal state
       </h:panelGroup>
      </h:form>
      
      ... more forms, the menu and stuff goes here ...
      


      Any help is appreciated. Thanks!

        • 1. Re: a4j:poll interfering with navigation
          nbelaevski

          Hello,

          Try adding a4j:queue.

          • 2. Re: a4j:poll interfering with navigation

            Hi

            Thanks, with this hint I was able to solve the problems. Just for the records:

            I added a view-wide named ajax events queue (outside of any form):

            <a4j:queue name="menu_queue" />


            This queue is referenced from the aj4:poll-component as well as from all RichFaces menu items that caused the problems. Interesting enough, these were only menu items that cause a SWF external redirect to some other flow definition.

            Thanks again!