# What is the difference between \`customHeaders\` and \`variables\` in an \`ActivatedJob\`

**URL:** <https://forum.camunda.io/t/what-is-the-difference-between-customheaders-and-variables-in-an-activatedjob/36717>\
**Category:** Discussion & Questions\
**Tags:** zeebe\
**Created:** [June 10, 2019, 11:44pm UTC](https://forum.camunda.io/t/what-is-the-difference-between-customheaders-and-variables-in-an-activatedjob/36717 "2019-06-10T23:44:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xmclark](https://forum.camunda.io/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@xmclark](https://forum.camunda.io/u/xmclark)\
**Post date:** [June 10, 2019, 11:44pm UTC](https://forum.camunda.io/t/what-is-the-difference-between-customheaders-and-variables-in-an-activatedjob/36717/1 "2019-06-10T23:44:10Z")

</div>

I came across these terms while studying the gateway proto file:

> <https://github.com/zeebe-io/zeebe/blob/develop/gateway-protocol/src/main/proto/gateway.proto#L32-L51>

What is the difference between these two fields, and when do I use them?

---

<div class="post-metadata">

**Author:** ![jwulf](https://forum.camunda.io/user_avatar/forum.camunda.io/jwulf/32/19654_2.png) [@jwulf](https://forum.camunda.io/u/jwulf)\
**Post date:** [June 11, 2019, 7:44am UTC](https://forum.camunda.io/t/what-is-the-difference-between-customheaders-and-variables-in-an-activatedjob/36717/2 "2019-06-11T07:44:05Z")

</div>

Variables are the keys of the job’s state object.

Custom Headers are a key:value object that is defined on the task instance. I demonstrate this at the end of this video: [https://youtu.be/xjzwUq-tHXE](https://youtu.be/xjzwUq-tHXE) (15m 22s in).

So you can genericize a task worker for a task type, and pass custom metadata to from the task instance in a BPMN process to modify its behaviour. I use it to drop `console.log('I am at ' + job.customHeaders.breakpoint)` in a process flow. You can use a single worker / task-type to emit information about specific tasks that way.

Maybe not the ultimate use case, but the first thing that came to my mind.

---

<div class="post-metadata">

**Author:** ![xmclark](https://forum.camunda.io/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@xmclark](https://forum.camunda.io/u/xmclark)\
**Post date:** [June 11, 2019, 6:47pm UTC](https://forum.camunda.io/t/what-is-the-difference-between-customheaders-and-variables-in-an-activatedjob/36717/3 "2019-06-11T18:47:14Z")

</div>

Thanks for pointing me the video. I think it’s a little more clear now.

I think if I had to explain the difference to someone else, I may use different terminology. Both custom headers and variables are data available in an activated job.

Correct me if I’m wrong, but it seems that custom headers are **static** in the sense that it does not change between workflow instances.

Variables are **dynanmic/runtime** data. They change between workflow instances.

Custom headers are not static to the job type because you could hypothetically have two different bpmn processes that are the same job-type but different custom headers.

---

<div class="post-metadata">

**Author:** ![jwulf](https://forum.camunda.io/user_avatar/forum.camunda.io/jwulf/32/19654_2.png) [@jwulf](https://forum.camunda.io/u/jwulf)\
**Post date:** [June 12, 2019, 1:47am UTC](https://forum.camunda.io/t/what-is-the-difference-between-customheaders-and-variables-in-an-activatedjob/36717/4 "2019-06-12T01:47:55Z")

</div>

Yes, custom headers are static to the task element instance.

I think of variables as the _job state_. Zeebe is kinda like a Redux store, and the workers are state reducers.

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 31, 2024, 10:11am UTC](https://forum.camunda.io/t/what-is-the-difference-between-customheaders-and-variables-in-an-activatedjob/36717/5 "2024-01-31T10:11:42Z")

</div>

Closed on January 31, 2024, 10:11am UTC


