3 Replies Latest reply on Apr 9, 2009 10:44 AM by o_lion

    Timer on node clarification

    o_lion

      Hi all,

      I'm beginner. I have a problem.
      I put a timer and an action on a node, but the timer never start.

      To start the timer do I have to modify anything? What can i do, have you got any idea?

      I have Jboss 4.2.3 GA and JBPM jbpm-3.2.6.SP1.



      My deployed process is:

      <?xml version="1.0" encoding="UTF-8"?>

      <process-definition xmlns="urn:jbpm.org:jpdl-3.2"
      name="processname">


      <start-state name="init">






      </start-state>




      test


      getValue






      <end-state name="finish"></end-state>

      </process-definition>


      I execute the process in my web application so:

      JbpmContext context= JbpmConfiguration.getInstance().createJbpmContext();
      try {

      Map <String , Object> variables= new HashMap<String, Object>();
      JbpmInputsParameter inputs= new JbpmInputsParameter();
      variables.put("inputsBean", inputs);
      System.out.println("Start process: "+Calendar.getInstance().getTime());
      ProcessInstance instance = context.newProcessInstance("process name");
      instance.addInitialContextVariables(variables);
      while (!instance.hasEnded()) {
      System.out.println("I'm in state "+instance.getRootToken().getNode().getName());
      instance.signal();
      }
      System.out.println("End process: "+Calendar.getInstance().getTime());

      System.out.println("The result is: "+instance.getContextInstance().getVariable("result"));

      } catch (Exception e) {
      e.printStackTrace();
      }finally{
      context.close();
      }

        • 1. Re: Timer on node clarification
          jbarrez

          You need to call the jbpmConfiguration.startJobExecutor() operation. Timers are in fact a subclass of Jobs, so something is needed to execute the (also dont forget to define a valid SchedulerService)

          • 2. Re: Timer on node clarification
            o_lion

            Ops, my right xml process is:

            <?xml version="1.0" encoding="UTF-8"?>
            
            <process-definition xmlns="urn:jbpm.org:jpdl-3.2"
             name="getIpAddressToMsisdn">
             <swimlane name="parameters"></swimlane>
            
             <start-state name="init">
             <task swimlane="parameters">
             <controller>
             <variable access="read,write,required" name="inputsBean"></variable>
             </controller>
             </task>
             <transition to="node1"></transition>
             </start-state>
            
             <node name="node1">
             <action name="callMsisdn" class="com.nsn.npc.jbpm.util.BeanActionHandler">
             <mBeanServiceName>
             com.nsn.npc.adapter:service=AlAdapter
             </mBeanServiceName>
             <methodName>
             getMsisdn
             </methodName>
             </action>
             <timer duedate="10 seconds" name="timeout" transition="to finish">
             <action></action>
             </timer>
             <transition to="finish" name="to finish"></transition>
             </node>
             <end-state name="finish"></end-state>
            
            </process-definition>


            • 3. Re: Timer on node clarification
              o_lion

              Sorry
              But i configure the scheduler with:

              <service name='scheduler' factory='org.jbpm.scheduler.db.DbSchedulerServiceFactory' />
              
              <bean name='jbpm.job.executor' class='org.jbpm.job.executor.JobExecutor'>
               <field name='jbpmConfiguration'><ref bean='jbpmConfiguration' /></field>
               <field name='name'><string value='JbpmJobExecutor' /></field>
               <field name='nbrOfThreads'><int value='1' /></field>
               <field name='idleInterval'><int value='1000' /></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>
              


              It's right?
              The timer don't change the state if the time of action over timer's time.

              Thanks in advanced