I'm working on a Camunda BPM project and my goal is to create a java project (either a .jar or .war) that contains several Delegates
to be called from the various processes.
What I want ultimately is for the users to be able to create a process using the modeler call the delegates supplied by the uploaded project.
In order to achieve this I think I might need to somehow wire the project to the camunda-engine, but I'm not sure how, I tried to upload the project in the modules
folder and add a module.xml
file with no success.
Here is the error I'm getting:
Cannot instantiate process definition Test__1:1:e038081e-7335-11e9-81d2-acd1b8773d2f: ENGINE-09008 Exception while instantiating class 'com.foo.sharedModule.MyDelegate': ENGINE-09017 Cannot load class 'com.foo.sharedModule.MyDelegate': com.foo.sharedModule.MyDelegate from [Module "deployment.camunda-webapp-ee-jboss-7.10.5-ee.war" from Service Module Loader]
Could anybody help me figure out the right way to do it please? Thank you.
Assuming you're on Wildfly or JBoss, and it seems that you are given your mention of modules, then you're on the right track.
If you want the Java classes to be universally available within the application server, including to any new applications (*.war or *.ear files) that you deploy - possibly with Camunda processes, decisions, etc. - or to Camunda deployments that you upload via the REST API, you'll want to package those up as JAR files and add them as modules. You will need to ensure that you add the proper module dependencies.
Given the added complexity associated with Wildfly/JBoss in this respect, it may help to simply state that all you would need to do if you were using Tomcat would be to package the classes up in a JAR file and put them in Tomcat's shared lib directory. The additional complexity beyond that is simply a result of the Wildfly/JBoss design rather than anything having to do with Camunda itself. Then you could use them in any process model, decision definition (DMN) or case within your Camunda instance.
I hope that helps!
Have a look at the camunda modeller templates.
They allow you to extend the modeller so users can choose predefined service components. You will than just need to include the jar in your process application.
What you are referring to is called a global task in the camunda specifications, which is not yet supported. (https://forum.camunda.org/t/how-is-a-global-task-defined/16455)
A solution would be a subprocess with only one task, that can be located in a different project. Subprocesses can be called globally with their process id. To achieve this you have to use the call activity. https://docs.camunda.org/manual/7.9/reference/bpmn20/subprocesses/call-activity/