`UserProvider` fails due to there not being some executions in Flowable engine after passing a parallel gateway

Hello team,

once we try to use a parallel gateway (where a token gets multiplied itself) we immediately get an error whenever a following user task uses a UserProvider which relies on the fact that current execution (i.e., token) already exists in the Flowable engine. But turns out this is just not the case. Only the original (pre-gate) execution exists or even no execution exists whatsoever, like in the test case.

Basically, the test case looks as follows:

A working project to play with (courtesy of @8pade8) https://github.com/8pade8/UserProviderTestCase, see README.md for details, but actually you just have to run project, login the app and start the only process.

Currently we use a gory workaround based on signal catching before each user task and an additional branch just for signal throwing after some timeout.

/сс Max Gorbunkov@gorbunkov

Regards,
Ilia Rodionov.

Hi,
why do you need execution objects inside the user provider? What do you do with them?

Seemingly, this is the only way to access process definition & task definition objects, let alone execution variables. The sample from docs relies on execution id as well: String userLogin = (String) bprocRuntimeService.getVariable(executionId, "userLogin");.

Getting process variables using the executionId:

bprocRuntimeService.getVariable(executionId, "userLogin")

works fine in your example

Ups, I was wrong regarding process variables - they work well indeed, but they couldn’t reveal which task exactly is asking for their candidates. If we have two tasks how can we draw a line between them?

1 Like

Do you mean that a provider should return a different set of users depending on the task name or task id? Won’t it be better to have two separate UserListProviders then?

If you really need to have one place where the assignment is done and analyze the task name there, then you may try to do the assignment with a TaskListener (see Flowable documentation). You’ll have an access to the DelegateTask object there and also you’ll be able to configure your task listener using the fields.

2 Likes

Thank you, looks as if DelegateTask solves our task.