cancel
Showing results for 
Search instead for 
Did you mean: 

Access to ActivityExecution outside of process

gkotschy
Champ in-the-making
Champ in-the-making
Hi,

I would like to execute activity behavior (eg evaluate expressions like name or due date) without having direct access to a DelegateExecution. Any idea how i could get access to a valid execution when the code is not being called from the process?

ty
5 REPLIES 5

trademak
Star Contributor
Star Contributor
What's your use case? In general I don't think this is a desired/supported behavior.

Best regards,

jorell
Champ in-the-making
Champ in-the-making
I have a similar need.
I am building a weborchestration service based on activiti. I have a generic delegate that has in and out paramaters. InParamaters are variables being send to the outside service and in parameters are variables I would like to update/add to the process variables in the process instance. So when I get a response I need to access the ActivityExecution so I can evaluate the outParameters and set those from the web service response. If there is an easier way to do this please let me know.
Thanks

jbarrez
Star Contributor
Star Contributor
How do you do this webservice call?

Your use case sounds very strange, I would expect you want to process thiose variables inside of the delegate

jorell
Champ in-the-making
Champ in-the-making
Our generic delegate will push messages onto a pubsub queue with the task name and task variables. The task name is something akin to a method name and the variables are its parameters. The client which reads the message is responsible for running the actual business logic with the given paramaters, and returning the output on another pubsub queue. Our engine is supposed to read this queue, find the write execution based on some meta info in the message and write any variables to the process instance (hopefully only the ones specified as out parameters in the bpmn).
As you can see, since we have to wait for the return call to write out variables, control has to be passed out of the delegate. And we need to get a handle on the delegate again in order to pass execution back to it.

frederikherema1
Star Contributor
Star Contributor
You can always implement a VariableScope instance which is backed by the "properties" retrieved from the API (runtimeService.getVariables(…) etc). Pass this variableScope to the ExpressionManager when evaluating expressions.

If you really need more details on the execution itself (current activity eg), query the Execution using the API…