Hi Camunda Team,
[Testing Environment]
Camunda Zeebe 8.5.1
Camunda Operate 8.5.1
JDK 21
spring-boot-starter-camunda 8.5.1
springboot 3.2.5
springcloud 2023.0.3
bpmn screenshot
[Q1]
Here is my code
@JobWorker(type = "test-camunda-851", autoComplete = false)
public void execute(final JobClient client, final ActivatedJob job) throws Exception {
LOGGER.info("Job-[{}] is activated, key-[{}]", job.getType(), job.getKey());
client.newThrowErrorCommand(job)
.errorCode("500")
.errorMessage("test exception")
.send()
.join();
}
I expect the flow node in the operate is marked red and show some exception information but there is no response. I try another way:
public static void main(String[] args) throws Exception {
ZeebeClient client = ZeebeClient.newClientBuilder()
.grpcAddress(URI.create("http://11.11.2.108:26500"))
.usePlaintext()
.build();
client.newWorker()
.jobType("test-camunda-851")
.handler((zeebeClient, job) -> {
System.out.println("job:" + job.getKey());
zeebeClient.newFailCommand(job)
.retries(job.getRetries() - 1)
.errorMessage("test exception")
.send()
.join();
System.out.println("done ~");
})
.open();
}
still no response in the operate. Did I something wrong ?
[Q2]
I ran the following code when I have run the code in Q1.
public static void main(String[] args) throws Exception {
ZeebeClient client = ZeebeClient.newClientBuilder()
.grpcAddress(URI.create("http://10.0.1.104:26500"))
.usePlaintext()
.build();
client.newWorker()
.jobType("test-camunda-851")
.handler((zeebeClient, job) -> {
System.out.println("job:" + job.getKey());
zeebeClient.newCompleteCommand(job.getKey()).send().join();
})
.open();
}
There is also no response. I think there is already a worker in the engine queue and I did not set the timeout in the @JobWorker in the Q1 code. How can I complete that worker (if it exist) and run a new worker ?