Hi Camunda users,
I apologize in advance for the naivety of this post but I’m trying to find the best option to implement some simple code snippets, for the momemt I use Java Delegates for this purpose but I see that it’s also possible to use external scripts.
My question is quite simple, what reasons should guide the use of either external scripts or java delegates?
Thanks in Advance, Chris
Have a look at this guide in our best practices which provides some information regarding delegates versus scripting versus other approaches. Either approach is acceptable. For really simple stuff you can use inline scripting though I find for more complex scripting I prefer to use a ‘real’ IDE to compose the script and then ‘point’ to it from a script task. The advantage of using this approach, as well as using delegates, is that you don’t create a new version of a process if you make a change in the code. If you change the code in an inline script a new version of the process is created. In this example a groovy script needs to be included in the deployment of this application:
Thanks for this clear answer, external scripts sound appealing indeed. I still have a question on the path that should be added, in
Ressource, can it be something like:
or external scripts should lie where my bpms are?
You’re welcome! If you used one of the Camunda archetypes to create a project in your IDE you can place the script in the
src/main/resources folder and refer to it just as
test.js in your process. If you’re not using a project in an IDE you can use
deployment://test.js and make sure to deploy it along with your .bpmn file using REST.
Perfect @Beagler! Thanks for your concern!