Hi,I have a custom service task with java delegatepublic class CustomServiceTask implements JavaDelegate {
private Expression a;
private Expression b;
@Override
public void execute(DelegateExecution execution) throws Exception {
a.getValue(execution);
b.getValue(execution);
}
}
I understand that service task class will only be instantiated once and then re-used by all process instances. Does it mean that in my process definition files I cannot use this service task twice with different field values?
<serviceTask id="javaService" name="Java service invocation"
activiti:class="CustomServiceTask">
<extensionElements>
<activiti:field name="a">
<activiti:expression>${varA}</activiti:expression>
</activiti:field>
<activiti:field name="b">
<activiti:expression>${varB}</activiti:expression>
</activiti:field>
</ extensionElements>
</ serviceTask>
…
<serviceTask id="javaService2" name="Java service invocation with other params"
activiti:class="CustomServiceTask">
<extensionElements>
<activiti:field name="a">
<activiti:expression>${varC}</activiti:expression>
</activiti:field>
<activiti:field name="b">
<activiti:expression>${varD}</activiti:expression>
</activiti:field>
</ extensionElements>
</ serviceTask>
The use case is that I have a re-usable Java Service that I need to invoke multiple times during the process but with different input parameters. If I use expressions with process variables that doesn't help much: it means that I have to populate the same process variable in advance before calling the ServiceTaskAny help on this will be highly appreciatedregards,Andrey