11 Replies Latest reply on Nov 9, 2007 6:32 AM by ericcart

    jbpm.esb & timers (startJobExecutor problem or BUG ?)

      I've been searching why jbpm.esb is not executing all timers.

      I narrowed the search to discover that jbpm.esb is not loading the default.jbpm.cfg.xml and org.jbpm.job.executor.JobExecutor.


      So I executed by hand with an action:

       public Message process(Message message)
       {
       jbpmConfiguration = JbpmConfiguration.getInstance();
       jbpmConfiguration.startJobExecutor();
      
       return message;
       }
      


      Now, all timers are running.

      So the question is, why is not loading by default JobExecutor ?

      Do I have to configure another thing to set the JobExecutor ? a MBean ?

      PD: The problem with the previous action is that when I undeploy my .esb all timers keep running... even when all the related classes are not present. So the timers must be stopped when my .esb is undeployed.


      Thanks,
      Eric

        • 1. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)
          kurtstam

          Isn't the file called 'jbpm.cfg.cml'? --Kurt

          • 2. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)


            jbpm.cfg.xml is empty, and It says that the default.jbpm.cfg.xml from jbpm-jpdl.jar is loaded.

            I tried both configurations:

            1. jbpm.cfg.xml empty with default.jbpm.cfg.xml
            2. Pasting all default.jbpm.cfg.xml inside jbpm.cfg.xml

            I think there's no specific code to load JobExecutor in jbpm.esb.

            Thanks,
            Eric

            • 3. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)
              kurtstam

              Can you post what xml config you tried to bring up the JobExecutor?

              thx,

              --Kurt

              • 4. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)
                kurtstam

                It looks to me that the jbpm-console.war brings up an executor:

                <!-- This servlet serves the purpose of executing pending timer jobs. -->
                 <!-- JbpmJobExecutorServlet BEGIN -->
                 <servlet>
                 <servlet-name>JobExecutorServlet</servlet-name>
                 <servlet-class>org.jbpm.job.executor.JobExecutorServlet</servlet-class>
                 <load-on-startup>1</load-on-startup>
                 </servlet>
                 <servlet-mapping>
                 <servlet-name>JobExecutorServlet</servlet-name>
                 <url-pattern>/jobs</url-pattern>
                 </servlet-mapping>
                


                but I've never tried to use it. Is the war deployed in your situation? We deploy one by default now in the jbpm.esb (as of 4.2.1)

                --Kurt

                • 5. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)

                  The default ones from the installation.

                  jbpm.cfg.xml

                  <jbpm-configuration>
                  
                   <!--
                   The default configurations can be found in org/jbpm/default.jbpm.cfg.xml
                   Those configurations can be overwritten by putting this file called
                   jbpm.cfg.xml on the root of the classpath and put in the customized values.
                   -->
                  
                  </jbpm-configuration>
                  


                  jbpm-jpdl.jar /org/jbpm/default.jbpm.cfg.xml

                  <jbpm-configuration>
                  ...
                   <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
                  
                   <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
                  
                   <field name="name"><string value="JbpmJobExector" /></field>
                  
                   <field name="nbrOfThreads"><int value="1" /></field>
                  
                   <field name="idleInterval"><int value="5000" /></field>
                  
                   <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
                  
                   <field name="historyMaxSize"><int value="20" /></field>
                  
                   <field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
                  
                   <field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
                  
                   <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
                  
                   </bean>
                  
                  
                  
                  </jbpm-configuration>
                  
                  



                  ..... and my final "workaround action", to load and unload the JobExecutor

                  /*
                   * StartJobExecutor.java
                   *
                   * Created on 8 de noviembre de 2007, 14:24
                   *
                   * To change this template, choose Tools | Template Manager
                   * and open the template in the editor.
                   */
                  
                  package someapp.bpm;
                  
                  import org.jboss.soa.esb.actions.AbstractActionLifecycle;
                  import org.jboss.soa.esb.actions.ActionUtils;
                  import org.jboss.soa.esb.helpers.ConfigTree;
                  import org.jboss.soa.esb.message.Body;
                  import org.jboss.soa.esb.message.Message;
                  
                  import org.apache.log4j.Logger;
                  
                  import org.jbpm.JbpmConfiguration;
                  import org.jbpm.job.executor.JobExecutor;
                  
                  /**
                   *
                   * @author Eric
                   */
                  public class StartJobExecutor extends AbstractActionLifecycle
                  {
                   protected ConfigTree _config;
                   private Logger logger = Logger.getLogger(StartJobExecutor.class);
                  
                   JbpmConfiguration jbpmConfiguration;
                  
                   /** Creates a new instance of StartJobExecutor */
                   public StartJobExecutor(ConfigTree config) {
                   _config = config;
                   }
                  
                   public Message noOperation(Message message)
                   {
                   return message;
                   }
                  
                   public void initialise() {
                   jbpmConfiguration = JbpmConfiguration.getInstance();
                   jbpmConfiguration.startJobExecutor();
                  
                   logger.info("StartJobExecutor initialised.");
                   }
                  
                   public void destroy() {
                   jbpmConfiguration.getJobExecutor().stop();
                   logger.info("StartJobExecutor destroyed.");
                   }
                  
                   public Message process(Message message)
                   {
                   return message;
                   }
                  
                   public void exceptionHandler(Message message, Throwable exception)
                   {
                   logger.error(exception);
                   }
                  }
                  



                  Thanks,
                  Erik

                  • 6. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)


                    That's the problem !! I'm working with light-minimum ESB version.... without Tomcat or any WAR.

                    PD: I don't think a core feature like timers should be tied to a UI choice.

                    • 7. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)
                      kurtstam

                      Gotcha now. But you're still running in a management environment right? So an MBean would do the trick for that (like you mentioned in the first post). So I guess you could create your own mbean, add the code that is in the servlet to bring up the JobExecutor. As long as you deploy the mbean in the jbpm.esb it should get the same lifecycle in terms of starting and stopping.

                      Let me know if that works and maybe you could send us the patch :).

                      thx,

                      --Kurt

                      • 8. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)


                        I think the "workaround action" It's better than a mbean.

                        It's included in the jboss-esb.xml, in the service that deploys the process. So, when .esb initializes and destroys, loads and unloads at the same time the JobExecutor.

                        A Mbean should be another external additional dependent service, only to load and unload the JobExecutor.... too heavy for this small thing ;-)

                        For example, you could simply include this small action inside the bpm_orchestrations quickstarts, after the action name="DeployFromFile" , without too additional complexity.

                        Thanks,
                        Eric

                        • 9. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)
                          kconner

                          This issue was fixed as part of http://jira.jboss.com/jira/browse/JBESB-1131 for ESB 4.2.1, there is now an MBean in the codebase which starts/stops the job executor.

                          The code can be found here http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/configuration/JbpmService.java

                          • 10. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)
                            kconner

                             

                            "ericcart" wrote:
                            A Mbean should be another external additional dependent service, only to load and unload the JobExecutor.... too heavy for this small thing ;-)

                            It isn't, honest :). The MBean I mentioned in my previous posting is now included within the jbpm service esb and should be handling this for you.

                            'ericcart' wrote:
                            For example, you could simply include this small action inside the bpm_orchestrations quickstarts, after the action name="DeployFromFile" , without too additional complexity.

                            If you were to do this then you would disable *all* background processing when one of these artifacts were undeployed, I do not think this is what you want to happen.

                            We are currently looking into the way in which we handle jBPM process deployments as part of a larger task examining our current jBPM integration. The jBPM processing does not really fit into the normal AS deployment/undeployment lifecycle for a number of reasons.

                            Kev

                            • 11. Re: jbpm.esb & timers (startJobExecutor problem or BUG ?)


                              Ok, I understand. Now I'll be working with the action, because I'm still developing and It's easier to stop and start all the background processing. But I´m integrating the Mbean too to include it in the future release.

                              Thank you for your answers,
                              Eric