How to deploy a java class in Camunda Run

Hi Guys!

I’m quite new in Camunda customization and the principles of Java as whole so my question might sound a bit silly. But I hope you can help me.

My situation is that, I am currently working with Camunda Run v7.16.5-ee, and being a standalone application, I’m quite interested where should I place the java class I’ve coded in the existing folders.

Should it be on the “webapps” folder under “internal”? or should I place it under the “configuration” folder then “resources”?

Here’s my view on the OOB folder structure.

Also, when I’m deploying a process into Camunda from Modeler, where does Camunda run place these resources?

Thanks!

Generally Camunda Run is used best when you’re code is externalized and implemented as part of the external task pattern. So If you’re looking orchestrate java classes i’d suggest using the spring boot distro.

Regarding deployment, when you deploy a model to Camunda Run via the Rest Api (or from the modeler) it’s stored in the database, not at an artifact in the file system.

1 Like

Hi @Niall ,

Thank you very much for the prompt response, so essentially if we are using Camunda Run, if we plan on using Execution/Task Listeners, it would be better to select, script → external resource then?

Then for the scripts, we just put them in the “resources” folder under “configuration”, is this right?

Just to clarify, the intended usage of Camunda Run is to get users quickly on-boarded to the Camunda Platform correct? But if we’re looking at let’s say a production grade system, we’re better of using the distros?

Thank you!

Hi @edcapulong

You can run listeners on Camunda Run if you like - if you create a named spring bean that implements the execution listener you can place it into the .\configuration\userlib folder. For example a class like this:

@Component(value = "someJavaClass")
public class SomeJavaClass implements TaskListener{

Can be called by deploying the model like this:

Not really, Camunda Run is the suggested distro to use if you’re interested in using Camunda to orchestrate external microservices. It is very much ready to be used in production, as with all other distros. The difference with the distros is instead based on what kind of architecture you want for your system.

This blog post explains some of the factors that can help you decided on which distro you should use based on what you’re trying to achieve.

Hi @Niall ,

Thank you for the clear response, does camunda have any documentations or maybe a template I can follow in creating this spring beans?

I found this link on Maven archetypes: Maven Project Templates (Archetypes) | docs.camunda.org am I on the right track?

Because most of the tutorials on YT that I’ve seen uses the link above as template or generating a new project template via start.camunda.com

But since I’m only trying to put in a spring bean to be called in my process, I’m not sure on what archetype should I use or if I should generate a new project template using the start.camunda.com

Thank you so much!

I think a good place to start for you could be to follow this tutorial playlist

Then maybe if you have additional questions you can ask here :slight_smile:

Hi @Niall ,

Started building my project based on the tutorial videos you’ve sent, but when I’m try to run my application, I’m encountering this error:

I was able to resolve this error previously on Run by adding the “jaxb-impl-2.3.3” into the “userlib” folder.

However now, when building my own project, I can’t get the error resolved even if I’ve added the dependency in the pom.xml file.

Thanks!

Just resolved it by updating the version.

Thanks!

Hi @Niall ,

While developing applications and making use of Camunda package interfaces, I’m faced with a challenge on how I can possibly get system generated variables. For the values of the variables gathered through forms it’s quite easy since you know how to reference the variable, but how do we do it for the system generated ones?

Is there a document I can refer to?

Thanks!

Can you explain what you mean by this? Do you mean external system variables or variables created by code orchestrated by the engine.

Hi @Niall

The use case I’m trying to achieve is to get the comments made on one task and reflect it to the next one, by default behavior Camunda doesn’t pass the comments made from the previous task so I’m trying to find a workaround for it.

Right now I’m trying to work with the “Comments” interface but I’m getting a null value…

I’m not really sure if I’m doing it correctly. Hope you can help. Thanks!!

Thanks!

Here I’m trying to use the .getFullMessage method of the comments interface, but no luck with it. I’m not sure if I need to create a new class for it?

I tried to get these system values through the DelegateExecution interface and I can get it

Not sure why I don’t when using the Comments interface.

Task comments are intended to live only on a specific task and not be passed beyond it.
If you’d like a variable to be accessible beyond a task you need to set it as part of the process instance by using the setVariable() method.

I agree, but does that mean that we can’t access the comment values that user inputs on one task and place it on a variable?

Thanks

my goal is to access/get the value of the comment input by the user from here…

I’m just not sure how I can get it so I can assign it to a global variable.

Thanks

If you’re trying to have someone add a comment that intended for another part of the process or another task, then don’t use task comments. They’re not intended for that use case.
Instead - create a process variable with comments and set that variable to the scope of the process.

Thank you for your inputs @Niall , with that I can then assume that my delegation code would then be quite limited to what the DelegateExecution interface offers as of the moments, is that correct?

Also, another question, will it be possible to edit the information displayed in this task tab?

image

I was planning on changing the details to the more relevant information based on our use case.

Thanks!!!

Hi @Niall

I tried creating a class that assigns a due date to multiple tasks in a process, it was working when I followed the tutorial that you sent me, however when I tried to extract my class to a jar file and place it to the “userlib” folder for Camunda Run, I am receiving an error that says…

image

Can you please help me what I might possibly lacking?

Thanks!

For additional context, I used the Camunda Maven archetype for engine-plugin.

image