Question

We can invoke a java code in activiti using a Java Service or with a groovy script. What is the difference between these two ways? And what are the relative advantages and disadvantages?

Edit -

Groovy scripts are more flexible but adds an extra dependency.

Can any one explain the other effects of these two approaches such as performance , stability of the application, What happens with a large number of parallel processes etc.

Was it helpful?

Solution

I have some good experience using Java Service Classes.

Activiti Engine will instantiate each JavaService class only once and reuse it next time it is needed by an other workflow action. The memory footprint will be quite small. I don't know how this is done on script tasks; i would guess they are "compiled" / interpreted every time again and again which can be slower and/or takes more resources and mem.

A second point is to mention that you can create abstract implementations for JavaService classes that already provide basic implementations. I don't really know how this will work on scripts.

A last point i think about is code validation during compile time. There i don't know how this is handled when using scripts...

Hope my answer helps a bit...

OTHER TIPS

Not sure if this a good answer or not, but the way I think of it. Service Task classes must implement the JavaDelegate interface where the execute method is what is called during process execution.

Script tasks give us more flexibility in that we can reference any configured "bean" and call any method we want.

Like I aid, this may not be complete, but is the way I think of it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top