AnsweredAssumed Answered

Service task with properties

Question asked by natedawg on Oct 31, 2016
Latest reply on Nov 3, 2016 by vasile.dirla
Hi all,

I am an Activiti novice. My company gave me a task of converting their current process engine over to Activiti. Current process engine is executing services (java API calls) in defined order, everything is specified using XML, similar to Activiti.  So I am using service tasks and each service task  contains parameters like service  type, name, various parameter, etc. What a service task is doing is starting services, a receive task is then used to wait for the service to send a response.
This is how it may look like in Activiti:

<serviceTask activiti:delegateExpression="${publisherBean}" activiti:exclusive="false" id="Torpedo_S1" name="Torpedo_S">
<extensionElements>
<activiti:field name="typeOfSystem">
<activiti:string>System_X</activiti:string>
</activiti:field>
<activiti:field name="name">
<activiti:string>Torpedo_S</activiti:string>
</activiti:field>
<activiti:field name="param1">
<activiti:string>execNow</activiti:string>
</activiti:field>
</extensionElements>
</serviceTask>
<receiveTask id="w_Torpedo_S1" name="W4Torpedo_S"/>


We are using Spring today and still want to use it for the new solution. Even before I started converting to Activiti I read about using Spring beans (singelton) and field parameters, and how this may is not be thread safe. Alternative 1 is to make prototype beans or alternative 2; rewrite the Java delegate to use an expression and passing the needed data to the delegate via a method arguments.

Question:
* Are we completly sure no race condition when using alternative 1?
* Is it possible to still have reference to DelegateExecution when using alternative 2?

Kind regards
A.H.

Outcomes