I’ve a very strange issue with Camunda running in a Spring Boot application. Up to now I did not require a running Tomcat (except the times when working with Camunda Cockpit). Now I tried to use the Tomcat server for monitoring purposes as well, but found out it was not reachable anymore.
This appears totally weired to me. I didn’t expect a change to the bpmn file to cause problems when starting up the Tomcat server. In the Spring Boot logs I canot see
[TomcatWebServer] Tomcat started on port(s): 8080 (http) with context path ‘’
anymore. There are no errors or warnings in the log.
I agree. It is very unlikely that this causes the problem.
If you can share example code and exact steps to reproduce it, I am happy to give it a look. Other than that, try to figure out if any Tomcat log files are written (or if this can be configured in the Spring boot environment).
I haven’t reduced my application to a minimal sample showing the problem yet. But I’ve made some progress on finding the cause. I’m not sure how to fix it properly.
Basically it’s due to having a call to
this.mCamundaRtService.startProcessInstanceByKey(this.mCamundaProcessName);
in a method of my Camunda-configuration class for Spring Boot which is annotated with @PostConstruct.
Effectively the call to startProcessInstanceByKey blocks until the process ends. The process is designed to be an endless loop (probably the first design error). Thus the method blocks endlessly. This blocks Spring to fully start up und thus keeps the Tomcat server from staring up.
The second error might be that the process is started up in the @PostConstruct annotated method instead of relying on Camunda magic to start processes. Basically his kind of starting the process has been done because the application makes use of two separate processes: a) a process waiting for new jobs to arrive (via database or message queue) b) a process which works on each arrived order. Process b) receives a message from process a) to start its work, after that has been done, the process terminates with an Terminate End Event. Is this against Camunda best practises?
I think I’ve a working solution. My job fetching process now looks like this:
The Start Job Fetcher event is marked as async before and exclusive. The timer is set to 1 sec interval.
As far as I can see Camunda does not think the process were stalled and keeps executing it within a single, not changing thread. Tomcat is started up properly as well (besides the rest of the Spring magic).
What’s a bit strange, is that delays of less than 5 seconds leads to actually no delay, Camunda keeps firing the activities. If found something similar in Fast repeating Timer Event not working properly, but cannot follow the argumentation there. Could you try to elaborate?
Second question: From my understanding of the docs I thought that setting the exclusive attribute effectively prevents Camunda from spawning up more than one thread to handle this workload. But I could not confirm this in my tests. When I made the job fetching take 20 seconds whilest setting the lockTimeInMillis to 10 seconds, Camunda spawned up new threads. So, there’s something else to it – can you please explain this to me?