Community

Variables Performance

created by Andre Muniz in jBPM - View the full discussion

Hi!

 

My use case is very simple: I need to load all the pending tasks and show information about them (including variables). But I'm having some performance problems when loading those variables.

 

Basically my code is like this:

 

 

// Builds the process engine
ProcessEngine processEngine = new Configuration().buildProcessEngine();
 
// Creates the services
TaskService taskService = processEngine.getTaskService();
ExecutionService executionService = processEngine.getExecutionService();
 
// Loads all the pending tasks
List < Task > tasks = taskService.createTaskQuery().list();
 
// Loads the variables for each task
for (Task t : tasks) {
 
     // Variable names
     Set < String > variableNames = new TreeSet < String >();
     variableNames.add("var1");
     variableNames.add("var2");
     variableNames.add("var3");
     variableNames.add("var4");
     variableNames.add("var5");
 
     // Loads the variables
     Map < String, Object > variables = executionService.getVariables(t.getExecutionId(), variableNames);
            
     // Shows variables information
     System.out.println(variables);
}

 

 

The "taskService.createTaskQuery().list()" method is very fast, but the processing time to load the variables is very high.

 

My question is:

Am I going in the right direction or there is another way to implement this use case with better performance?

 

PS: I've seen the JIRA request to include searching for process instances by variables (https://jira.jboss.org/jira/browse/JBPM-2505) and there are some comments about variable performance, but I'm not sure that in my use case I should have this kind of problem.

 

Thanks!

Reply to this message by going to Community

Start a new discussion in jBPM at Community