Jobworker throws Warning: Ignoring the error of type 'NOT_FOUND' during

Hi,
I am running Camunda 8 locally using GitHub - camunda/camunda-platform: Links to Camunda Platform 8 resources, releases, and local development config and docker-compose.

My workflow is quite simple:

In the first service task a Java Sping Zeebe client generates a random number and stores several variables as process variables. Then a user should guess the number that was generated. If the number was correct, the process do a log output and the process ends.
If the number was wrong, it will be checked if the number of retries is still larger than 0, the entered number will be analyzed if it was larger or lower the random number and the user can enter a new number.

That’s my process.

Now my problem: The zeebe worker looks like this:

@Component
@Slf4j
public class RandomNumber {
    private final Random random =new Random();

    @JobWorker(type="randomNumber")
    public void getRandomNumber(final JobClient client, final ActivatedJob job) {
        Map<String, Object> map = new HashMap<>();
        int min = 1;
        int max = 10;
        map.put(WorkflowConstants.WF_VAR_RETRIES, 5);
        map.put(WorkflowConstants.WF_VAR_RANGE_START, min);
        map.put(WorkflowConstants.WF_VAR_RANGE_END, max);
        map.put(WorkflowConstants.WF_VAR_RANDOM_NUMBER,random.nextInt(max - min + 1) + min);
        log.info("variables initialized");
        client.newCompleteCommand(job.getKey()).variables(map).send();
    }
}

When I set a breakpoint into this function, the application stopps, I can check every values and when I resume the application, the process variables are all visible in Operate.
When I remove the breakpoint, I still got the log output “variables initialized”, but there are no variables within the process itself. Operate says “The Flow Node has no Variables”.

Instead of the variables I got the following log output, too.

2024-02-17T16:44:14.836+01:00  WARN 22296 --- [ault-executor-0] .DefaultCommandExceptionHandlingStrategy : Ignoring the error of type 'NOT_FOUND' during {command=class io.camunda.zeebe.client.impl.command.CompleteJobCommandImpl, job={"key":2251799813705438,"type":"randomNumber","customHeaders":{},"processInstanceKey":2251799813705433,"bpmnProcessId":"Process_RateDieZahl","processDefinitionVersion":3,"processDefinitionKey":2251799813703297,"elementId":"Activity_GetRandomNumber","elementInstanceKey":2251799813705437,"tenantId":"<default>","worker":"randomNumber#getRandomNumber","retries":3,"deadline":1708184940377,"variables":"{}","variablesAsMap":{}}, currentRetryDelay=50}. Job might have been canceled or already completed.

I am using Java 21, Spring 3.2.2, Zeebe Starter 8.4.1 and Zeebe Client 8.4.3.

Does anyone has an idea, what’s wrong? I think the client.newCompleteCommand is the problem, but I found no other way to send workflow variables within a @JobWorker function.

Best regards,

Rainer

Ok, I found one solution in an other topic.

When I change the annotation as follows, it works.

    @JobWorker(type="randomNumber", autoComplete = false)
    public void getRandomNumber(final JobClient client, final ActivatedJob job) {

But is there an other way to add some variables and use the “autoComplete=true”?

Hi @Ironarrow,

when you use the Spring Zeebe client, you can return the map in your worker method and keep the autocomplete to the default value true. Then you don’t need to call the newCompleteCommand().

Hope this helps, Ingo

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.