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 complete a three-organization message loop: dic.dsf.test → cos.dsf.test → hrp.dsf.test → back to dic.dsf.test. The DIC process will no longer end immediately after sending — it will wait for a reply from HRP (or time out after two minutes).
Solutions to this exercise are found on the branch solutions/exercise-6.
Background reading (documentation links for this exercise)
-
Modify
exampleorg_dicProcess(dic-process.bpmn)Why this step is needed: Right now the DIC process ends when it sends the
helloCosmessage. We need it to pause and wait for agoodbyeDicreply from HRP instead. To achieve this, the Message End Event must become an Intermediate Message Throw Event — meaning the process continues rather than ending.Change Message End Event → Intermediate Message Throw Event
- Click the Message End Event → change its type to Intermediate Throw Event (Message) (the envelope in a circle, not filled)
- The field injections (
profile,messageName,instantiatesCanonical) stay the same - In
HelloCosMessage.java, change the implemented interface fromMessageEndEventtoMessageIntermediateThrowEvent
Add an Event Based Gateway after the throw event
- Draw a sequence flow from the Intermediate Throw Event to a new Event Based Gateway (pentagon symbol)
- The process will now wait at this gateway until one of the configured events fires
Configure two outgoing paths from the gateway: one leading to a Message Intermediate Catch Event and one leading to a Timer Intermediate Catch Event. Both paths must end with a plain End Event.
| Path | Event type | Purpose | |---|-------------------------------------------------------------------|---| | Path 1 | Message Intermediate Catch Event — message name:
goodbyeDic| Process continues normally when HRP replies | | Path 2 | Timer Intermediate Catch Event — duration:PT2M(2 minutes) | Process ends with a timeout if HRP does not reply |Click the Event Based Gateway → choose either Message Intermediate Catch Event or Timer Intermediate Catch Event
-
Modify
exampleorg_cosProcess(cos-process.bpmn)Work through the four sub-steps in order:
Change the `Cos Task` element into a Service Task.
- In Camunda Modeler, click the
Cos Taskelement → change its type to Service Task (wrench icon) - Set Implementation to Java Class and enter:
org.tutorial.process.tutorial.service.CosTask
Why: A plain Task element in BPMN is just a label — it does not execute any Java code. A Service Task connects to a Java class and calls its
execute()method when the process reaches it.Change the End Event into a Message End Event.
- Click the End Event → change its type to Message End Event (filled envelope)
- This event will send a Task to
hrp.dsf.testto startexampleorg_hrpProcess
Set the Java class and BPMN message reference.
- Set Implementation to Java Class:
org.tutorial.process.tutorial.message.HelloHrpMessage - In the Message tab, create or select a BPMN message and name it
helloHrp
Set the Field Injections.
Look at
fhir/ActivityDefinition/hrp-process.xmlto find the values:| Field | Where to look in hrp-process.xml | Value | |---|---|---| |
profile|<extension url="task-profile"><valueCanonical .../>|http://example.org/fhir/StructureDefinition/task-hello-hrp|#{version}| |messageName|<extension url="message-name"><valueString .../>|helloHrp| |instantiatesCanonical|<url value="..."/>→ append|#{version}|http://example.org/bpe/Process/hrpProcess|#{version}| - In Camunda Modeler, click the
-
Fix the HRP process id and class names (
hrp-process.bpmn)Set the process `id` (currently `change_me`) and `version tag`.
- The id follows the pattern
{publisher}_{processName}. Derive it fromfhir/ActivityDefinition/hrp-process.xml: - The
<url>element reads:http://example.org/bpe/Process/hrpProcess - The last segment is
hrpProcess - The publisher prefix in this tutorial is
exampleorg - Result:
exampleorg_hrpProcess
Note: The field is called
idon the<bpmn:process>element — not "key". It uniquely identifies the process within the BPE.Fix the Java class name in the `HrpTask` service task.
Currently the BPMN contains a wrong class name. The correct fully qualified class name is:
org.tutorial.process.tutorial.service.HrpTaskFix the Java class name in the `GoodbyeDicMessage` end event.
Same issue. The correct fully qualified class name is:
org.tutorial.process.tutorial.message.GoodbyeDicMessage - The id follows the pattern
-
Add a new authorization block to the DIC
ActivityDefinition(fhir/ActivityDefinition/dic-process.xml)The DIC process must now also accept the
goodbyeDicmessage that HRP sends back. Add a second<extension url="http://dsf.dev/fhir/StructureDefinition/extension-process-authorization">block with the following four components:4a) Message name
4b) Task profile
4c) Requester — who may sendgoodbyeDic? Only remote organizations with theHRProle inmedizininformatik-initiative.de.
4d) Recipient — who may receivegoodbyeDic? Only local organizations with theDICrole.Not sure which role codes are available?
Take a look at the dsf-organization-role CodeSystem.
Need a refresher on process authorization in ActivityDefinitions?
Take a look at the guide on creating ActivityDefinitions.
-
Forward the
tutorial-inputparameter from DIC to COSOverride `HelloCosMessage#getAdditionalInputParameters`
The
HelloCosMessageclass (HelloCosMessage.java) currently sends no additional input parameters. OverridegetAdditionalInputParametersto readtutorial-inputfrom the DIC start Task and include it in the outgoing COS Task. You can model your implementation onHelloHrpMessagewhich already does this.Add the `tutorial-input` slice to `task-hello-cos.xml`
The COS Task profile (
fhir/StructureDefinition/task-hello-cos.xml) must declare thetutorial-inputinput parameter, otherwise the DSF will reject the Task as non-conformant. Copy thetutorial-inputslice definition fromtask-start-dic-process.xmland add it totask-hello-cos.xml. -
Register all processes and resources in
TutorialProcessPluginDefinition- Add
bpe/hrp-process.bpmntogetProcessModels() - Add a new map entry for
ConstantsTutorial.PROCESS_NAME_FULL_HRPingetFhirResourcesByProcessId()listing its ActivityDefinition, StructureDefinition, and any CodeSystem/ValueSet files
- Add
-
Add the
CosTask,HelloHrpMessage,HrpTaskandGoodbyeDicMessageclasses as Spring Beans. Remember to use the right scope. -
Again, we introduced changes that break compatibility. Older plugin versions won't execute the HRP process because the process id in the BPMN model was still invalid. Increment your resource version to
1.4.
Execute a maven build of the dsf-process-tutorial parent module via:
mvn clean install -Pexercise-6
Verify that the build was successful and no test failures occurred.
To verify the exampleorg_dicProcess, exampleorg_cosProcess and exampleorg_hrpProcesses 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.
Don't forget that you will have to add the client certificate for the HRP instance to your browser the same way you added it for the DIC and COS instances
in exercise 1 and exercise 4 or use the Keycloak user Tyler Tester with username test and password test. Otherwise, you won't be able to access https://hrp/fhir. You can find the client certificate
in .../dsf-process-tutorial/browser-certs/hrp/hrp-client.p12 (password: password).
-
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 console 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 DSF FHIR server for the
hrp.dsf.testorganization in a fifth console at location.../dsf-process-tutorial/dev-setup:docker compose up hrp-fhirVerify the DSF FHIR server started successfully at https://hrp/fhir.
-
Start the DSF BPE server for the
hrp.dsf.testorganization in a sixth console at location.../dsf-process-tutorial/dev-setup:docker compose up hrp-bpeVerify the DSF BPE server started successfully and deployed the
exampleorg_hrpProcess. The DSF BPE server should print a message that the process was deployed. The DSF FHIR server should now have a new ActivityDefinition resource. Go to https://hrp/fhir/ActivityDefinition to check if the expected resource was created by the BPE while deploying the process. The returned FHIR Bundle should contain three ActivityDefinition resources. Also, go to https://hrp/fhir/StructureDefinition?url=http://example.org/fhir/StructureDefinition/task-hello-hrp to check if the expected Task profile was created. -
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 FHIR Task resource was created at the DSF FHIR server and the
exampleorg_dicProcesswas executed by the DSF BPE server of thedic.dsf.testorganization. The DSF BPE server of thedic.dsf.testorganization should print a message showing that a Task resource to start theexampleorg_cosProcesswas sent to thecos.dsf.testorganization.
Verify that a FHIR Task resource was created at the DSF FHIR server of thecos.dsf.testorganization and theexampleorg_cosProcesswas executed by the DSF BPE server of thecos.dsf.testorganization. The DSF BPE server of thecos.dsf.testorganization should print a message showing that a Task resource to start theexampleorg_hrpProcesswas sent to thehrp.dsf.testorganization.Based on the value of the Task.input parameter you send, the
exampleorg_hrpProcesswill either send agoodbyeDicmessage to thedic.dsf.testorganization or finish without sending a message.To trigger the
goodbyeDicmessage, usesend-responseas thetutorial-inputinput parameter.Verify that the
exampleorg_dicProcesseither finishes with the arrival of thegoodbyeDicmessage or after waiting for two minutes.
Prerequisites • Exercise 0 • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6 • Exercise 7