Prerequisites • Exercise 0 • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6 • Exercise 7
Communication between organizations in BPMN processes is modeled using message flow. The fourth exercise shows how a process at one organization can trigger a process at another organization.
To demonstrate communication between two organizations we will configure message flow between the processes dsfdev_dicProcess
and dsfdev_cosProcess
. After that, the processes are to be executed at the organizations dic.dsf.test
and cos.dsf.test
respectively in the docker dev setup, with the former triggering execution of the latter by automatically sending a Task resource from organization dic.dsf.test
to organization cos.dsf.test
.
In order to solve this exercise, you should have solved exercise 2 and read the topics on Messaging, Message Delegates, Version Pattern, URLs and Setting Targets for Message Events.
Solutions to this exercise are found on the branch solutions/exercise-4
.
-
Replace the End Event of the
dsfdev_dicProcess
in thedic-process.bpmn
file with a Message End Event. Give the Message End Event a name and an ID and set its implementation to theHelloCosMessage
class.
Configure field injectionsinstantiatesCanonical
,profile
andmessageName
in the BPMN model for the Message End Event. Usehttp://dsf.dev/fhir/StructureDefinition/task-hello-cos|#{version}
as the profile andhelloCos
as the message name. Figure out what the appropriateinstantiatesCanonical
value is, based on the name (process definition key) of the process to be triggered.Can't remember how instantiatesCanonical is built?
Read the concept here again.
-
Modify the
dsfdev_cosProcess
in thecos-process.bpmn
file and configure the message name of the Message Start Event with the same value as the message name of the Message End Event in thedsfdev_dicProcess
. -
Create a new StructureDefinition with a Task profile for the
helloCos
message.Don't know how to get started?
You can base this Task profile off the
StructureDefinition/task-start-dic-process.xml
resource. Then look for elements that need to be added, changed or can be omitted. -
Create a new ActivityDefinition resource for the
dsfdev_cosProcess
and configure the authorization extension to allow thedic.dsf.test
organization as the requester and thecos.dsf.test
organization as the recipient. The file has to be calledcos-process.xml
.Don't know how to get started?
You can base this ActivityDefinition off the
ActivityDefinition/dic-process.xml
resource. Then look for elements that need to be added, changed or can be omitted. Or you can take a look at the guide on creating ActivityDefinitions. -
Add the
dsfdev_cosProcess
and its resources to theTutorialProcessPluginDefinition
class. This will require a new mapping entry with the full process name of thecosProcess
as the key and a List of associated FHIR resources as the value. -
Modify
DicTask
service class to set thetarget
process variable for thecos.dsf.test
organization. -
Configure the
HelloCosMessage
class as a Spring Bean in theTutorialConfig
class. Don't forget the right scope. -
Again, we introduced changes that break compatibility. Older plugin versions at the COS instance won't be able to handle the Task resource type we added earlier. Increment your resource version to
1.3
.
Execute a maven build of the dsf-process-tutorial
parent module via:
mvn clean install -Pexercise-4
Verify that the build was successful and no test failures occurred.
To verify the dsfdev_dicProcess
and dsfdev_cosProcess
es can be executed successfully, we need to deploy them into DSF instances and execute the dsfdev_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 COS
instance to your browser the same way you added it for the DIC
instance
in exercise 1 or use the Keycloak user Tyler Tester
with username test
and password test
. Otherwise, you won't be able to access https://cos/fhir. You can find the client certificate
in .../dsf-process-tutorial/test-data-generator/cert/cos-client/cos-client_certificate.p12
(password: password).
-
Start the DSF FHIR server for the
dic.dsf.test
organization in a console at location.../dsf-process-tutorial/dev-setup
:docker-compose up dic-fhir
Verify the DSF FHIR server started successfully at https://dic/fhir.
-
Start the DSF BPE server for the
dic.dsf.test
organization in another console at location.../dsf-process-tutorial/dev-setup
:docker-compose up dic-bpe
Verify the DSF BPE server started successfully and deployed the
dsfdev_dicProcess
. -
Start the DSF FHIR server for the
cos.dsf.test
organization in a console at location.../dsf-process-tutorial/dev-setup
:docker-compose up cos-fhir
Verify the DSF FHIR server started successfully at https://cos/fhir.
-
Start the DSF BPE server for the
cos.dsf.test
organization in another console at location.../dsf-process-tutorial/dev-setup
:docker-compose up cos-bpe
Verify the DSF BPE server started successfully and deployed the
dsfdev_cosProcess
. 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://cos/fhir/ActivityDefinition to check if the expected resource was created by the BPE while deploying the process. The returned FHIR Bundle should contain two ActivityDefinition resources. Also, go to https://cos/fhir/StructureDefinition?url=http://dsf.dev/fhir/StructureDefinition/task-hello-cos to check if the expected Task profile was created. -
Start the
dsfdev_dicProcess
by posting a specific FHIR Task resource to the DSF FHIR server of thedic.dsf.test
organization 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
dsfdev_dicProcess
was executed by the DSF BPE server of thedic.dsf.test
organization. The DSF BPE server of thedic.dsf.test
organization should print a message showing that a Task resource to start thedsfdev_cosProcess
was sent to thecos.dsf.test
organization.
Verify that a FHIR Task resource was created at the DSF FHIR server of thecos.dsf.test
organization and thedsfdev_cosProcess
was then executed by the DSF BPE server of thecos.dsf.test
organization.
Prerequisites • Exercise 0 • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6 • Exercise 7