operaton / operaton/operaton

Enrich Running Tasks with ROOT_PROC_INST_ID_

Open
#892 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

database
Dominant language
Java
Stars
469
Forks
128
Avg merge
1d 42m
Merged PRs (30d)
156

Description

Given is a processdefinition which contains a multi-instance-callactivity.
The called processdefinition contains UserTasks.

The collection from which the mutli-instance is consuming is 1001 elements long, which leads to 1001 sub-processinstances wich leads to 1001 tasks.

We want to list all tasks which are (directly) created and currently running from our root-processinstance.

If you have history enabled, than you could query this list:

processEngine.getHistoryService()
                     .createHistoricTaskInstanceQuery()
                     .rootProcessInstanceId("1234")
                     .unfinished()

Asking the historic-tables is not recommended because it could contain a huge amount of data.

If you don't have history enabled, you have to query all processInstanceIds which have "1234" as rootProcessInstance and execute page-requests aftewards, because you will get 1001 IDs, which are not allowed in IN-clauses.

Describe the solution you'd like

Enrich the TaskEntity with the rootProcessInstanceId and enrich the query:

  processEngine.getTaskService()
                     .createTaskQuery()
                     .rootProcessInstanceId("1234")
                     .list()

Additional context

Since we are adding a column, we have to fill existing rows the data via SQL.
We could take the ACT_RU_EXECUTION.ROOT_PROC_INST_ID_ since the EXECUTION_ID_ is already in the table ACT_RU_TASK.EXECUTION_ID_

I'm not quite sure if this should already add an index on the new column. If not, this should be noted in die JavaDoc of this new method.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with TaskEntity and the TaskService createTaskQuery() entry point, then trace ACT_RU_TASK.EXECUTION_ID_ to ACT_RU_EXECUTION.ROOT_PROC_INST_ID_. Done means the rootProcessInstanceId("1234") query returns currently running tasks without history, existing rows are populated via SQL, and the index decision is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
backend, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.