Variable limitation with @Variable in SPring Zeebe

Hi,
I’m using Spring Zeebe to implement my C8 JobWorker. I’ve chosen the @Variable approach as I want to limit the variables which are loaded from Zeebe.

The documentation states " With @Variable or fetchVariables you limit which variables are loaded from the workflow engine."

However I saw in the debugger that the worker actually loads all variables and then throws the unnecessary ones away. Is this the way it is meant to be? My expectation is, that it works as “fetchVariables”, which works as expected and loads the names variables only.

So the basic question is, if this is a bug or a feature and can I expect a fix for it?

Kind regards
Holger

Hi @holgerhagen, welcome to the forum! What version of Camunda and what version of the Spring SDK are you using?

Hi @nathan.loding ,
I’m running with Spring Boot v3.4.3, Spring v6.2.3.
Camunda is c8 run 8.6.9 and Camunda client 8.6.13.

Hello @holgerhagen ,

the magic that makes everything work is done here:

TL;DR: Variable filtering is applied unless you enabled forceFetchAllVariables or you inject the ActivatedJob.

Best regards,

Jonathan

2 Likes

Hi @jonathan.lukas ,
thanks for your reply. This points to the actual problem I guess. Because I always inject the ActivatedJob as it is stated in the documentation:

@JobWorker(type = "foo")
public void handleJobFoo(final JobClient client, final ActivatedJob job, @Variable String variable1) {
  System.out.println(variable1);
  // ...
}

Leaving out the ActivatedJob seems to do the trick. Maybe the documentation should give an advice on this?

Best regards
Holger

Hello @holgerhagen ,

thank you for the feedback.

I took this to the documentation team and we will implement your remark in the near future.

Best regards,

Jonathan

1 Like