How to start camunda parallel gateway in multi threaded mode

Hi I am new to camunda an trying to run parallel gateway. I want to execute it in multi threaded fashion.
Three task should run int in three parallel threads.
how I can achieve that??

Each process instance in the engine is single threaded so this would not be possible using a parallel gateway.

Yes each process in single thread.
but under process we can have separate service task. I want to execute those task in multi threaded manner.
say for example

in above bpm i wanted to execute task 1 and task 2 in two threads and combining the output in task 3
is the possible?

I’m not sure exactly what you’re asking for.
You cannot run a process instance in a multi threaded manner.

If you’re interested in creating transaction boundaries so that the threads commit their state before task 1 and/or task 2 you can do that by selecting “Asyncronous Before” on a give task to force a commit.

1 Like

Have a look at external tasks. Your task handling code can run in any threading setup you like.

1 Like

Hi,

My suggestion would be to treat the process model and the programming model as two separate constructs.

At the process model, a parallel gateway indicates that the following tasks on the parallel branches may occur in any order or concurrently. Its not really about a multi-threaded programming model.

At the programming level, if you really want these tasks to run in parallel using separate threads you could;
Use the external task paradigm as mentioned by @Thorben.
Use asynchronous continuations and mark the tasks as non-exclusive as per the documentation [1]

regards

Rob

[1] https://docs.camunda.org/manual/7.6/user-guide/process-engine/the-job-executor/#concurrent-job-execution

2 Likes
  • In this way, one of the tasks will be executed repeatedly