Prerequisites • Exercise 0 • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6 • Exercise 7
In this exercise you will add a decision point to the exampleorg_dicProcess: based on the value of the tutorial-input parameter sent with the start Task, the process will either trigger exampleorg_cosProcess or stop right there.
The file you will primarily work in is dic-process.bpmn and DicTask.java.
Solutions to this exercise are found on the branch solutions/exercise-5.
Background reading (documentation links for this exercise)
-
Open
tutorial-process/src/main/resources/bpe/dic-process.bpmnin Camunda Modeler and add an Exclusive Gateway between theDicTaskservice task and the current end/message-end event.Connect two outgoing sequence flows from the gateway:
- Path A: leads to the Message End Event that sends
helloCos(from Exercise 4) → startsexampleorg_cosProcess - Path B: leads to a plain End Event → stops
exampleorg_dicProcesswithout contacting COS
Camunda Modeler instructions
- Click the
DicTaskservice task → select Append Gateway - Draw a sequence flow from the gateway to the existing Message End Event (Path A)
- Draw another sequence flow from the gateway to a new plain End Event (Path B)
- Path A: leads to the Message End Event that sends
-
Add a condition expression to each outgoing sequence flow so the BPE knows which path to take at runtime.
The BPE uses JUEL (Java Unified Expression Language) for conditions. Condition expressions read process variables by name. For a boolean variable called
sendToCos, the expressions would be:Sequence flow Condition expression Meaning Path A (→ COS) ${sendToCos}Take this path when sendToCosistruePath B (→ End) ${!sendToCos}Take this path when sendToCosisfalseYou can freely choose the variable name — just make sure it matches exactly between the condition expressions here and the process variable you set in step 4.
Camunda Modeler instructions
- Click a sequence flow arrow → in the properties panel on the right, find Condition Type → select Expression
- Enter the expression (e.g.
${sendToCos}) in the Expression field
-
In the
DicTaskclass, read thetutorial-inputstring from the start Task and derive a boolean decision from it.What: Evaluate whether the input value signals that the COS process should be started.
Why: The gateway condition reads a process variable — that variable must be set by your Java code before the gateway is reached. This is done in the next step.Not sure how to read the tutorial-input parameter?
Use the
TaskHelpertogether withvariablesas you did in Exercise 2. The input type code istutorial-inputfrom CodeSystemhttp://example.org/fhir/CodeSystem/tutorial. Once you have the string value, decide on a convention — for example,"true"means start COS, anything else means stop. -
Store the boolean result as a named process variable using
variables.setBoolean(...). The variable name must be identical to the name used in the condition expressions in step 2.
Execute a maven build of the dsf-process-tutorial parent module via:
mvn clean install -Pexercise-5
Verify that the build was successful and no test failures occurred.
To verify the exampleorg_dicProcess and exampleorg_cosProcesses can be executed successfully, we need to deploy them into DSF instances and execute the exampleorg_dicProcess. The maven install build is configured to create a process jar file with all necessary resources and copy the jar to the appropriate locations of the docker dev setup.
-
Start the DSF FHIR server for the
dic.dsf.testorganization in a console at location.../dsf-process-tutorial/dev-setup:docker compose up dic-fhirVerify the DSF FHIR server started successfully at https://dic/fhir.
-
Start the DSF BPE server for the
dic.dsf.testorganization in a second console at location.../dsf-process-tutorial/dev-setup:docker compose up dic-bpeVerify the DSF BPE server started successfully and deployed the
exampleorg_dicProcess. -
Start the DSF FHIR server for the
cos.dsf.testorganization in a third at location.../dsf-process-tutorial/dev-setup:docker compose up cos-fhirVerify the DSF FHIR server started successfully at https://cos/fhir.
-
Start the DSF BPE server for the
cos.dsf.testorganization in a fourth console at location.../dsf-process-tutorial/dev-setup:docker compose up cos-bpeVerify the DSF BPE server started successfully and deployed the
exampleorg_cosProcess. -
Start the
exampleorg_dicProcessby posting a specific FHIR Task resource to the DSF FHIR server of thedic.dsf.testorganization using either cURL or the DSF FHIR server's web interface. Check out Starting A Process Via Task Resources again if you are unsure.Verify that the
exampleorg_dicProcesswas executed successfully by thedic.dsf.testDSF BPE server and possibly theexampleorg_cosProcessby thecos.dsf.testDSF BPE server, depending on whether decision of your algorithm based on the input parameter allowed starting theexampleorg_cosProcess.
Prerequisites • Exercise 0 • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6 • Exercise 7