Hi all
I’m not sure, if I’m doing things wrong or if I came over a new bug.
I developed a Spring Boot Application called Camunda External Task Client Spring Boot Template, which I will use for our students learning to work with Camunda in a Microservices architecture. I will call this application Client in the following lines.
I also developed a Spring Boot Application containing the Process Engine and Webapps, called Camunda Projekttemplate. I will call this application Server in the following lines.
Both applications work as they should, despite of one strange behaviour: When I’m starting the Client before starting the Server, I supposed, that this would raise an ExternalTaskClientException, because there is no server with the provided baseURL, who is listening for REST API calls. Therefore I put the code in a try-catch as shown below.
But no Exception is raised when connecting to a non-existing server. The Exception is raised some seconds later, when the actual Fetch&Lock-algorithm starts. But at this time it can no longer be catched by my try-catch-statement.
Am I misunderstanding something relevant or is this a bug?
try {
externalTaskClient = ExternalTaskClient
.create() // Den ExternalTaskClientBuilder initiieren
.baseUrl(baseUrl) // URL der REST API der Process Engine
.workerId("ExternalTaksClientSpringBootTemplateApplication") // Eindeutiger Name, damit die Process Engine "weiss", wer einen bestimmten Task gelocked hat
.maxTasks(10) // Wie viele Tasks sollen maximal auf einen "Schlag" (Batch) gefetched werden
.lockDuration(2000) // Long Polling für 2 Sekunden (2000 Millisekunden) -> siehe https://docs.camunda.org/manual/latest/user-guide/process-engine/external-tasks/#long-polling-to-fetch-and-lock-external-tasks
.build(); // Die External Task Client-Instanz mit den vorhergehenden Angaben erstellen
externalTaskClient
.subscribe("SendTweet")
.handler(tweetSenderHandler)
.open();
} catch (ExternalTaskClientException etce) {
System.err.println("Fehler beim Erstellen des External Task Clients. Details: " + etce.getLocalizedMessage());
}