Prerequisites • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6
Communication between organizations in BPMN processes is modeled using message flow. The third 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 Test_DIC
and Test_COS
respectively in the docker dev setup, with the former triggering execution of the latter by automatically sending a Task resource from organization Test_DIC
to organization Test_COS
.
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 andcosProcess
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
cosProcess
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 theTest_DIC
organization as the requester and theTest_COS
organization as the recipient.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 theTest_COS
organization. -
Configure the
HelloCosMessage
class as a Spring Bean in theTutorialConfig
class. Don't forget the right scope.
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 you created in exercise 3 for the cos
realm. 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
Test_DIC
organization in a console at location.../dsf-process-tutorial/dev-setup
:docker-compose up dic-fhir
Verify the DSF FHIR server started successfully.
-
Start the DSF BPE server for the
Test_DIC
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
Test_COS
organization in a console at location.../dsf-process-tutorial/dev-setup
:docker-compose up cos-fhir
Verify the DSF FHIR server started successfully. You can access the webservice of the DSF FHIR server at https://cos/fhir.
-
Start the DSF BPE server for the
Test_COS
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 theTest_DIC
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 theTest_DIC
organization. The DSF BPE server of theTest_DIC
organization should print a message showing that a Task resource to start thedsfdev_cosProcess
was sent to theTest_COS
organization.
Verify that a FHIR Task resource was created at the DSF FHIR server of theTest_COS
organization and thedsfdev_cosProcess
was then executed by the DSF BPE server of theTest_COS
organization.
Prerequisites • Exercise 1 • Exercise 1.1 • Exercise 2 • Exercise 3 • Exercise 4 • Exercise 5 • Exercise 6