[jboss-user] [jBPM] New message: "Re: Multiple Subprocess - jBPM 3.3.1"

Luca Zammarchi do-not-reply at jboss.com
Thu Feb 4 05:53:49 EST 2010


User development,

A new message was posted in the thread "Multiple Subprocess - jBPM 3.3.1":

http://community.jboss.org/message/524121#524121

Author  : Luca Zammarchi
Email   : luca.zammarchi at antex.it
Profile : http://community.jboss.org/people/lucazammarchi

Message:
--------------------------------------------------------------
Hi,
I implemented a solution that has the same result:
 
- I created some "process instances" from one process definition
- then I created an ExecuteNodeJob for each process instance and I sent it to the MessageService.
- In ArrayList I was putting all process instance ids
- With a timer I was checking all process and wait for all processes.
 
Below the function I use to create the process:
public long createSubProcess(ExecutionContext executionContext,
               String processName,HashMap variabili,boolean signalToken ){
 
 
                //Create process instance
          ProcessInstance subProcessInstance = executionContext.getJbpmContext().newProcessInstance(processName);
 
 
 
                //Setting any variable 
                Iterator iterator = variabili.keySet().iterator();
          while(iterator.hasNext()){
               String key=(String)iterator.next();
               contextInstance.setVariable(key, variabili.get(key));
          }
 
          Token token=subProcessInstance.getRootToken();
 
          token.setNodeEnter(Clock.getCurrentTime());
 
 
                //Signal the token of the process if needed
          if(signalToken)
               token.signal();
               
                //Create the job
          ExecuteNodeJob job = new ExecuteNodeJob(token);
          job.setNode(token.getNode());
          
          Calendar dataCorrente = Calendar.getInstance();
          dataCorrente.add(Calendar.MINUTE, 1);
          job.setDueDate(dataCorrente.getTime());
          job.setExclusive(true);
 
 
                //Send the job to the message service
          MessageService messageService = (MessageService)Services.getCurrentService("message");
          messageService.send(job);
          token.lock(job.toString());        
 
 
                //Return the process instance id to the main program
          return subProcessInstance.getId();
 
     }

 
I am testing this solution.
 
Has anyone a better idea?
 
 
I think this is a ploy help me to have multiple processes that running asynchronously.
 
Best regards.
 
Luca Zammarchi

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/524121#524121




More information about the jboss-user mailing list