When to use task input vs header for a constant

Hello

Apologies if this topic has been answered before, but I didn’t find anything meaningful.

I am somehow confused, when modeling my tasks, as to when to define an input constant as a variable (which has been possible for a few releases and the switch to FEEL) or as a custom header.

The only differences I can see is that :

  • input variables can be mapped to nice DTOs, but are trickier to edit for non developers
  • headers are easier to edit in the modeler, but cannot be complex types

Also, do they follow the same rules wrt. model updates?
For example, if I update my constants in variables and headers, and deploy the new workflow on my Zeebe cluster, do the updated constants both apply only to instances created after the deployment.

Thanks

Edit: removed “input variables cannot be assigned a constant containing a space” as a reason against input variables, this is not true with version 0.10 of the zeebe modeler.

Hi @ajeans,

thank you for raising this up.

The main difference between custom headers and input variables is that the headers are constant values for the job worker. Input variables can be calculated during the workflow execution.

Technically, input variables have more overhead because they are evaluated on runtime and are written to the log stream and state as variables.

Besides that, it is up to the job worker.

Best regards,
Philipp

1 Like

A custom header can be a complex type. With JSON.parse all things are possible.

As Aristotle famously said:

Give me a string variable and JSON.parse and I will serialise the world.

1 Like