[jboss-user] [JBoss jBPM] - Re: async processes : favour termination instead of inceptio

jeffj55374 do-not-reply at jboss.com
Wed Oct 3 13:42:50 EDT 2007


Hi,
I'm facing a similar issue.  We need to process 100's of groups of files. Each file group results in the creation of a process instance.  Each process has a number of steps. Some of these steps take 10's of minutes or hours to process. Therefore we are using the embedded async continuation method to allow for nodes to be processed in parallel to leverage our multi-cpu system.  When a new job is created for each async node, it is given a due date of the current system time.

 
  | See Node.createAsyncContinuationJob: 
  | 
  | protected ExecuteNodeJob createAsyncContinuationJob(Token token) {
  |     ExecuteNodeJob job = new ExecuteNodeJob(token);
  |     job.setNode(this);    job.setDueDate(new Date());    job.setExclusive(isAsyncExclusive);
  |     return job;
  |   }


The job executor thread acquires jobs based on the results of a querying the JBPM_JOB table and sorting by due date.  The JobExecutorThread acquires jobs by calling JobSession.getFirstAcquirableJob() which executes the query below.  Note the results are ordered by due date.
 
  | 
  | <query name="JobSession.getFirstAcquirableJob">
  |     <![CDATA[
  |       select job
  |       from org.jbpm.job.Job as job
  |       where ( (job.lockOwner is null) or (job.lockOwner = :lockOwner) )
  |       and job.retries > 0
  |       and job.dueDate <= :now
  |       and job.isSuspended != true    order by job.dueDate asc    ]]>
  |   </query>

Essentially async nodes are processed in the order in which they were created, this is completely different than the order in which the process instances where created.  This essentially means that all the early nodes of all processes instances are executed before the later nodes of the first process instance.   i.e. I would really like the job executor to work on nodes associated with the first process instance before working on nodes associated with subsequent process instances.  i.e. if possible complete ready process instance 1 jobs before working on process instance 2 jobs.

Options I'm considering:

  | 1. Modify Node.createAsyncContinuationJob() to use the create date of the processes instance for the job due date rather than just using new Date();
  | 2. Creating my own sub class of org.jbpm.job to add in another member that saves my priority and modify the JobSession.getFirstAcquirableJob query accordingly
  | 3. Modifying the JobSession.getFirstAcquirableJob query to order the list by process instance ID first and then due date.   At the moment this seems like the most straight forward approach and doesn't require me to modify or extend jBPM code or modify the schema.
  | 
  | 
  | Anyone have other ideas?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091172#4091172

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091172



More information about the jboss-user mailing list