2 Replies Latest reply on Feb 25, 2008 6:43 AM by Siddharth Budhiraja

    Problem with Timer, Scheduler

    Siddharth Budhiraja Newbie

      I am facing a problem while trying to use the Timer and Scheduler service of jBPM.


      The process definition that I am using is:-

      <process-definition name='SchedulerService'>
       <start-state name='StartState'>
       <transition to='next'>
       <action class='jBPM.action.ActionClass'/>
       </transition>
       </start-state>
       <state name='next'>
       <timer name='Timer' duedate='3 seconds' repeat='1 seconds'>
       <action class='jBPM.action.ActionClass'/>
       </timer>
       <transition to='EndState'>
       </transition>
       </state>
       <end-state name='EndState'></end-state>
      </process-definition>



      Within jbpm.cfg.xml, I am using 'DbSchedulerServiceFactory' :-

      <jbpm-context>
      ...
      <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
      ...
      </jbpm-context>



      Everything works fine with this except that no action (named ActionClass) is executed at the specified time i.e. after 3 seconds of coming onto the node named 'next'. The action is not even called once so no wonder that it never gets repeated after every 1 second.

      I have used the same action while transitioning from the 'StartState' to 'next', and it gets executed when a signal is given. But the same action is not called with the Timer.

      I am using Timer along with persistence, i.e. all the data goes into database. So, I create jbpmContext before using timer (which is required). Also, till the time I am at node 'next', timer data still remains in database in JBPM_JOB table but when the process instance moves forward to the next state (i.e. 'EndState') the timer gets cancelled and deleted from database, which is also correct. So, the point is that everything is working as expected but still the action specified on the timer is not getting executed at all.

      If you can please find out some time and look into the issue, it will be of great help.

      Thanks in Advance.



        • 1. Re: Problem with Timer, Scheduler
          Ronald van Kuijk Master

          I'm wondering what using the search on this forum (e.g. using google) would yield.... probably something like: "start the jobexecutor"

          • 2. Re: Problem with Timer, Scheduler
            Siddharth Budhiraja Newbie

            Thanks for the reply. I tried starting the JobExecutor and it looks like it is running too.

            What I did was :-

            1. Created the following entry in my web.xml

            <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>
            
            
            When I hit the url (/jobs), it displays me a page which tells JbpmJobExecutor isAlive:true


            Also, I change my jbpm.cfg.xml file, I replaced the following :-

            <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>
            

            with the following :-

            <!-- <null name="jbpm.job.executor" /> -->


            Rest remains the same.

            But still no timer action is getting executed at all.

            One more thing, I am using Weblogic as my application server and trying to use jbpm timer in my enterprise application.

            Please if you can provide some input about what is going wrong.