cancel
Showing results for 
Search instead for 
Did you mean: 

TaskQuery missing .variableValueEquals()

thomas1
Champ in-the-making
Champ in-the-making
Hi,

I started evaluating Activiti and I am quite impressed. It was very easy to write an example workflow and use the API, straight foward, very nice, thanks for the execellent work.

I implemented a simple order management with these nodes:
Start -> UserTask -> ServiceTask -> End
The UserTask sets a variable that decides if the order goes to the ServiceTask or to an EndError node, this works fine so far.

Concerning performance I am stuck at the moment because my TaskQuery is way too slow. I am not sure if I misuse Activiti or if a feature is missing.

When I start the workflow I set a variable "department" = "dep1". This way I started 100.000 Workflows for 500 different departments - this was very fast as well.

To get the tasks I do the following at the moment:

TaskQuery taskQuery = taskService.createTaskQuery();taskQuery.taskDefinitionKey("userTask");taskQuery.taskName("Allow order");List<Task> taskList = taskQuery.list();for (Task task : taskList) {   Map<String, Object> variables = taskService.getVariables(task.getId());   final String taskDepartment = (String)variables.get("department");   if (taskDepartment.matches("dep1")) {      System.out.println("Hit!");   }}‍‍‍‍‍‍‍‍‍‍‍‍

Obviously this runs forever. 100.000+1 SQL Queries are executed, then I have to throw away 99.800 of the results.

Querying the process instances on the other hand is very fast:
ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();query.variableValueEquals("department", "dep1");rc = query.list();‍‍‍

So this should be possible for Tasks as well?


Thanks,
Thomas
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
I started evaluating Activiti and I am quite impressed. It was very easy to write an example workflow and use the API, straight foward, very nice, thanks for the execellent work.

Thanks!

Regarding your question: It is not yet possible to query tasks using variables.

I've filed a feature request for it: http://jira.codehaus.org/browse/ACT-501
However, this will not be implemented in the near future due to more important feature requests at this moment.

Alternatively, we can offer a 'backport' to run custom SQL queries, see http://jira.codehaus.org/browse/ACT-502
This can be implemented very quickly. Are you capable/willing of building from trunk and trying this fix for us?

thomas1
Champ in-the-making
Champ in-the-making
I've filed a feature request for it: http://jira.codehaus.org/browse/ACT-501
However, this will not be implemented in the near future due to more important feature requests at this moment.

Alternatively, we can off a 'backport' to run custom SQL queries, see http://jira.codehaus.org/browse/ACT-502
This can be implemented very quickly. Are you capable/willing of building from trunk and trying this fox for us?

Yes of course.
At the moment this is a showstopper for me but I really like Activiti. If there is a way around the showstopper I'd be happy to help out.

Thanks for your help!


Regards,
Thomas

frederikherema1
Star Contributor
Star Contributor
Hi,

I just resolved http://jira.codehaus.org/browse/ACT-588, which adds taskVariableValueEquals() to the taskQuery, will be available in 5.3.