External worker service task variables

I am using external worker tasks and have a question about input variables. In my setup, I have multiple scenarios where I need to have a process variable which is a large list and I iterate on it using multi-instance characteristic triggering an external task for each.
My problem comes from the fact that for every service task, the input is the loopCounter, the item the iteration is on and the entire list. This creates redundant large requests which I want to avoid. From my understanding, an external worker service task has access to all process variables, but I want to control it’s input variable the following way:

    <serviceTask id="externalTask" name="externalTask" flowable:type="external-worker"
      flowable:topic="external-task-topic" >
      <extensionElements>
        <flowable:field name="text">
            <flowable:string>
              This is a single value!
          </flowable:string>
        </flowable:field>
      </extensionElements>
    </serviceTask>

I didn’t manage to make this syntax work to control the data fetched when a job is acquired.

  1. Is there a better way to solve my situation?
  2. Does it make sense to open a PR that enables extension elements on external-worker service tasks?
    Thanks!

Hi @aviv.levintal,

this feature was introduced with this PR:

The syntax is slightly different than what you wrote down. You will find a few examples on how to use it as part of the tests of the PR.

Valentin

1 Like

Awesome thanks! Is this included in 7.1.0?

Yes this is included in 7.1.0