avatarGhailene ben Marzouk

Summary

This article explains the different types of gateways in Camunda, including Exclusive, Inclusive, Parallel, EventBased, and Complex Gateways.

Abstract

The article provides an overview of the different types of gateways in Camunda, a workflow and decision automation platform. It explains the Exclusive Gateway, which allows only one path to be followed based on a condition, and the Inclusive Gateway, which allows multiple conditions to be true. The Parallel Gateway allows multiple tasks to be executed in parallel, while the EventBased Gateway triggers events based on certain conditions. The Complex Gateway is used to document complex processes but is not executable. The article also provides examples and use cases for each type of gateway.

Opinions

  • The author believes that the Exclusive Gateway is a simple and effective way to control the flow of a process.
  • The author suggests that the Inclusive Gateway is useful for scenarios where multiple conditions need to be met.
  • The author highlights the benefits of the Parallel Gateway for executing multiple tasks simultaneously.
  • The author notes that the EventBased Gateway is useful for triggering events based on certain conditions.
  • The author acknowledges that the Complex Gateway is not executable but can be used to document complex processes.

gateways in Camunda

Today i m gonna show you the different type of gateways

Exclusive gateway:

based on a condition of a variable we gonna pass throught a specific path and tasks

example: if number > 0 we gonna pass throught the task “show positive number”

if number <0 we gonna pass throught the task “show negative number”

its quiet sample no ?

The bpmn file :

let s deploy it :

start it :we gonna put the number 1 and as we can see we passed throught the task “show positive number” because the number > 0

Inclusive gateways:

multiple condition may be true

in this example, we have two variable which we gonna be filled in the first task, temperature variable and place, so in the case when we put the temperature =x and place =”paris” we gonna pass thourght the two task “show cloudy weather” and “Show rainy wheather” in the same time because its an inclusive gateway and the multiple condition is allowed here.

lets deploy it and start it:

condition expression :

start the process and fill the form of the first task:

as we can see we passed through the two tasks:

because the two condition are allowed.

Parallel Gateway:

the parallel gateway let us do more than one task in the same time (in parallel) example a person can drive a car , listen to a radio and talk to his friend in the car. (all that in parallel)

this a bpmn file example:

lets deploy and start it :

Here we go, as we can see her , we have the three tasks in parallel:

EventBased gateway:

after the gateway EventBased we will have a list of events(timer,message conditional), that will triggred.

we created a process we have a based event gateway, also we added a conditional event (its like the gateway) we will get the variable isOK and will test the value if its OK or not to pass.

i ll deploy and start it :

we need to put the variable name isOK to pass by the conditional event

as we can see we passed here by the conditional event:

Case of not variable or variable with value !=NO :

in the case when we dont put the variable ,the token will stay in the based event gateway:

and after the timer event time passed it will pass through the other task :

Complex Gateway:

based on this article : https://forum.camunda.io/t/example-complex-gateway-split/1041 0 and as what Naill said There are no examples of the use of a Complex gateway for execution, because it’s not executable. It’s really only used to document processes. It usually just hides something very complex.

Notes: we use gateway join for example :

For this example for incoming flows, the Parallel Gateway will wait for all incoming flows before triggering the flow through its outgoing Sequence Flows.

so the outgoing parallel gateway will wait until all the task (Drive car, Listen to the radio, talk to a friend) finish

to resume :

  • Exclusive Gateway (XOR) — where only one path is followed (a binary situation)
  • Inclusive Gateway (OR) — where one or more paths can be followed
  • Parallel Gateway (AND) — where both paths are followed in parallel
  • Complex Gateway — where multiple inputs are processed and based on certain condition/rule a merged/converged output is created for the next activity.

Thank you for reading my article, please contact me for any further information.

Other Camunda topics:

camunda task events notifier camunda genericuser task listener in camunda task marker multi-instance taskmarker loop in camunda feel language camunda how to work with dmn how to work with dmn how-to-use-embedded-task-form-in-camunda all-about-camunda-database error-handling-in-camunda sub-process-in-camunda gateways-in-camunda camunda-with-spring-boot-example task-in-camunda events-in-camunda

Recommended from ReadMedium