9 Replies Latest reply on Oct 31, 2009 1:36 AM by Sunay Shah

    Need Help :: <a4j:queue /> Not working as expected

    Sunay Shah Apprentice

      Hello All,

      Please Help me out, I have one extended data table and it is sending concurrent request, so i have put it inside the <a4j:queue> tag but when i am tracing i can find that the request is not queued up but it is concurrently calling my code and due to that creates some problem. I stuck here with the problem of concurrency . below is my code.

      Thanks in Advance.
      Sunay S Shah


      <a4j:queue requestDelay="100000" ignoreDupResponce="true">
       <rich:extendedDataTable id="table" value="#{contractInstanceList.genericList}" var="pi" rows="14" >
      
       <rich:column filterBy="#{pi.id}" sortBy="#{pi.id}" filterEvent="onkeyup" sortable="true" label="Id" headerClass="idcolumn" sortOrder="DESCENDING" >
       <f:facet name="header" >
       <h:outputText value="Instance Id"/>
       </f:facet>
       <h:outputText value="#{pi.id}" />
       </rich:column>
      
      
       <rich:column filterBy="#{pi.maintainanceType}" sortBy="#{pi.maintainanceType}" filterEvent="onkeyup" headerClass="idcolumn" sortable="true" label="Maintainance Type" >
       <f:facet name="header">
       <h:outputText value="Maintainance Type" />
       </f:facet>
       <h:outputText value="#{pi.maintainanceType}" />
       </rich:column>
      
       </rich:column>
       <f:facet name="footer" style="text-align:center;">
       <h:panelGroup>
       <rich:datascroller id="ds" reRender="table" limitToList="true" style="tablescroll">
       </rich:datascroller>
       <rich:spacer height="18" />
       </h:panelGroup>
       </f:facet>
      
       </rich:extendedDataTable>
      </a4j:queue>


        • 1. Re: Need Help :: <a4j:queue /> Not working as expected
          Ilya Shaikovsky Master

          queue defined in a wrong way. check documentation.

          • 2. Re: Need Help :: <a4j:queue /> Not working as expected
            Sunay Shah Apprentice

            After defining the queue in right manner as in documentation still it sends multiple request and my table is not updated some time.

            • 3. Re: Need Help :: <a4j:queue /> Not working as expected
              Stijn Cremers Novice

              please post your new code

              • 4. Re: Need Help :: <a4j:queue /> Not working as expected
                Sunay Shah Apprentice

                Thanks for Early Reply...

                See the following code


                <h:form>
                <ga:attribute name="rendered" value="#{proclist != null}"/>
                <a4j:queue id="dataQueue"/>
                <a4j:region id="dataPanel">
                <rich:dataTable align="center" value="#{definitionList.genericList}" var="pd"
                rowClasses="row1, row2" id="pdlist" rows="15"
                columnClasses="50,100,100,100"
                onRowMouseOver="this.style.backgroundColor='#B5F3FB'"
                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.rowBackgroundColor}'"
                immediate="true">

                <f:facet name="header">
                <rich:columnGroup>
                <rich:column colspan="6">
                <h:outputText value="Contracts By Category" rendered="#{type == 'contracts'}"/>
                <h:outputText value="Other Contract Sub Processes" rendered="#{type != 'contracts'}"/>
                </rich:column>
                </rich:columnGroup>
                </f:facet>
                <rich:column filterBy="#{pd.id}" sortBy="#{pd.id}" filterEvent="onkeyup" headerClass="idcolumn" sortOrder="DESCENDING">
                <f:facet name="header">

                <h:outputText value="ID" />
                </f:facet>
                <h:outputText value="#{pd.id}" />
                </rich:column>

                <rich:column filterBy="#{pd.name}" sortBy="#{pd.name}" filterEvent="onkeyup">
                <f:facet name="header">
                <h:outputText value="Contract Name" />
                </f:facet>
                <h:outputText value="#{pd.name}" />
                </rich:column>
                <rich:column filterBy="#{pd.description}" sortBy="#{pd.description}" filterEvent="onkeyup">
                <f:facet name="header">
                <h:outputText value="Contract Category" />
                </f:facet>
                <h:outputText value="#{pd.description}" />
                </rich:column>
                <rich:column filterBy="#{pd.version}" sortBy="#{pd.version}" filterEvent="onkeyup" headerClass="idcolumn">
                <f:facet name="header">
                <h:outputText value="Version" />
                </f:facet>
                <h:outputText value="#{pd.version}" />
                </rich:column>
                <rich:column>
                <f:facet name="header">
                <h:outputText value="Details" />
                </f:facet>
                <h:outputLink value="procdef.jsf?id=#{pd.id}" title="Contract Instances">
                <h:graphicImage alt="Process Instances" value="/images/instances_alt.gif" width="27" height="18" styleClass="pic2"/>
                </h:outputLink>
                <rich:spacer width="3"/>
                <h:outputLink value="procdef.jsf" title="Contract Tasks">
                <f:param name="id" value="#{pd.id}"/>
                <f:param name="view" value="task"/>
                <h:graphicImage alt="Process Tasks" value="/images/task_view.gif" styleClass="pic2"/>
                </h:outputLink>
                <rich:spacer width="3"/>
                <h:outputLink value="procdef.jsf" title="Contract Status">
                <f:param name="id" value="#{pd.id}"/>
                <f:param name="view" value="img"/>
                <h:graphicImage alt="Process Image" value="/images/process_view.gif" styleClass="pic2"/>
                </h:outputLink>
                </rich:column>
                <rich:column align="center">
                <f:facet name="header">
                <h:outputText value="Actions" />
                </f:facet>
                <ga:checkRole roles="#{access.role.process.delete}">
                <h:commandLink>Delete
                <ga:attribute name="onclick"
                value="return confirm('#{msgs['confirm.process.delete']}')"/>
                <f:param name="id" value="#{pd.id}"/>
                <ga:parameter name="id" target="#{id}">
                <f:convertNumber integerOnly="true"/>
                </ga:parameter>
                <j4j:loadProcess id="#{id}" target="#{pdx}"/>
                <j4j:delete value="#{pdx}"/>
                <n:nav outcome="success" url="confirmation.jsf" storeMessages="true"/>
                <n:nav outcome="error" url="confirmation.jsf" storeMessages="true"/>
                </h:commandLink>
                <rich:spacer width="5" />
                </ga:checkRole>
                <ga:checkRole roles="#{access.role.process.start}">
                <h:commandLink rendered="#{pd.name != 'Renewal_Termination'}">Start
                <f:param name="id" value="#{pd.id}"/>
                <ga:parameter name="id" target="#{id}">
                <f:convertNumber integerOnly="true"/>
                </ga:parameter>
                <j4j:loadProcess id="#{id}" target="#{pdx}"/>
                <j4j:startProcess process="#{pdx}" target="#{pi}"/>
                <n:nav outcome="started" url="confirmation.jsf" storeMessages="true"/>
                <n:nav outcome="error" url="confirmation.jsf" storeMessages="true"/>
                </h:commandLink>
                <h:commandLink action="#{contractInstance.setContractInstanceState}" rendered="#{pd.name == 'Renewal_Termination'}">Start
                <f:setPropertyActionListener target="#{contractInstance.id}" value="#{pd.id}" />
                <n:nav outcome="success" url="activateContract.jsf" storeMessages="true"/>
                <n:nav outcome="error" url="activateContract.jsf" storeMessages="true"/>
                </h:commandLink>

                </ga:checkRole>
                </rich:column>
                <!--
                <rich:column align="center">
                <f:facet name="header">
                <h:outputText value="Records" />
                </f:facet>
                <h:commandButton value="Dummy Records" action="#{dummyContract.setVariables}">
                <f:setPropertyActionListener target="#{dummyContract.id}" value="#{pd.id}" />
                <n:nav outcome="success" url="processes.jsf" storeMessages="true"/>
                <n:nav outcome="error" url="busy.jsf" storeMessages="true"/>
                </h:commandButton>
                </rich:column>
                -->

                <f:facet name="footer" style="text-align:center;">
                <h:panelGroup>
                <rich:datascroller id="ds" renderIfSinglePage="false" reRender="pdlist" limitToList="true" style="tablescroll" >
                </rich:datascroller>
                <rich:spacer height="18" />
                <h:commandButton value="Add New Contract" onclick="document.location.href='deployproc.jsf';return false;" class="footerbutton"/>
                </h:panelGroup>
                </f:facet>
                </rich:dataTable>
                </a4j:region>

                </h:form>

                • 5. Re: Need Help :: <a4j:queue /> Not working as expected
                  Stijn Cremers Novice

                  try this: <a4j:queue size="1" ignoreDupResponses="true" />

                  • 6. Re: Need Help :: <a4j:queue /> Not working as expected
                    Sunay Shah Apprentice

                    i have already tried this , my problem is my grid is not able to update its view because before second response is comming first respose renders the view and not update, again i click browser's refresh button it gives correct data.

                    • 7. Re: Need Help :: <a4j:queue /> Not working as expected
                      Ilya Shaikovsky Master

                      you defined name of the queue - please remove it - so it will became default for this form and will handle all the requests.

                      • 8. Re: Need Help :: <a4j:queue /> Not working as expected
                        Sunay Shah Apprentice

                        <a4j:queue size="1"/>

                        i have tried with this statement as well still not working, my datatable is not able to update its view some time

                        • 9. Re: Need Help :: <a4j:queue /> Not working as expected
                          Sunay Shah Apprentice

                          I can see my header changing but data is not able to change