ServiceTask vs Job Executor

I am trying to bring my knowledge about the way camunda handles tasks within BPMNs. Assuming, I do have 2 processes, where each has a serviceTask with custom java-delegate and run them in parallel:

<bpmn2:serviceTask id="Activity_0bdfq5g" camunda:class="com.some.org.MyCustomDelegate">
      <bpmn2:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="x">XXX</camunda:inputParameter>
        </camunda:inputOutput>
      </bpmn2:extensionElements>
</bpmn2:serviceTask>

Which camunda component is responsible to execute them? At first I was thinking about job executor, but docs says it’s only involved in case of:

  1. A timer event
  2. A task marked for asynchronous execution

But it also says:

A job is an explicit representation of a task to trigger process execution

which somehow makes me think it still triggered while executing any task/job.

Any details on the subject? Thank you in advance

All job is done by job executor, except works, that done by external worker in case of external task.

Please refer the blog for job executor.

1 Like

Service Task and Job executor are two different things
Service Task are used when you want to perform automated actions and there are different flavors of service task like invoking a delegate deployed in process engine(Synchronous), HTTP API call(Synchronous), External task(Asynchronous)

Job Executor : is involved when asynchronous wait state is included in model explicitly or timer is involved in the model, it will execute the activities more asynchronously and update the state back.
Refer :Transactions in Processes | docs.camunda.org
The Job Executor | docs.camunda.org

@vicmosin Correct. If any activity is marked for asynchronous execution, then job executor executes those activities. If the activity execution is synchronous, the execution will be continued on the application server’s http-thread-pool (We call this “borrowing the client thread”)

Many thanks @aravindhrs , this was very helpful. But one question I do still have in mind - if service-task borrow the thread from main process, is there any limitation of amount of service-tasks which can be executed in parallel? Can it be configured via camunda engine properties or mostly done at JVM level?

Thank you in advance

@vicmosin If service tasks are executed synchronously, it uses thread from underlying application/web server thread pools. If the server is not able to handle the load, then scaling comes to the rescue. You can execute tasks in parallely in camunda.