Skip to content

Latest commit

 

History

History
executable file
·
89 lines (72 loc) · 8.48 KB

exercise-4.md

File metadata and controls

executable file
·
89 lines (72 loc) · 8.48 KB

PrerequisitesExercise 1Exercise 1.1Exercise 2Exercise 3Exercise 4Exercise 5Exercise 6


Exercise 4 - Messaging

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.

Exercise Tasks

  1. Replace the End Event of the dsfdev_dicProcess in the dic-process.bpmn file with a Message End Event. Give the Message End Event a name and an ID and set its implementation to the HelloCosMessage class.
    Configure field injections instantiatesCanonical, profile and messageName in the BPMN model for the Message End Event. Use http://dsf.dev/fhir/StructureDefinition/task-hello-cos|#{version} as the profile and cosProcess as the message name. Figure out what the appropriate instantiatesCanonical 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.

  2. Modify the dsfdev_cosProcess in the cos-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 the dsfdev_dicProcess.

  3. 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.

  4. Create a new ActivityDefinition resource for the dsfdev_cosProcess and configure the authorization extension to allow the Test_DIC organization as the requester and the Test_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.

  5. Add the dsfdev_cosProcess and its resources to the TutorialProcessPluginDefinition class. This will require a new mapping entry with the full process name of the cosProcess as the key and a List of associated FHIR resources as the value.

  6. Modify DicTask service class to set the target process variable for the Test_COS organization.

  7. Configure the HelloCosMessage class as a Spring Bean in the TutorialConfig class. Don't forget the right scope.

Solution Verification

Maven Build and Automated Tests

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.

Process Execution and Manual Tests

To verify the dsfdev_dicProcess and dsfdev_cosProcesses 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).

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Start the dsfdev_dicProcess by posting a specific FHIR Task resource to the DSF FHIR server of the Test_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 the Test_DIC organization. The DSF BPE server of the Test_DIC organization should print a message showing that a Task resource to start the dsfdev_cosProcess was sent to the Test_COS organization.
    Verify that a FHIR Task resource was created at the DSF FHIR server of the Test_COS organization and the dsfdev_cosProcess was then executed by the DSF BPE server of the Test_COS organization.


PrerequisitesExercise 1Exercise 1.1Exercise 2Exercise 3Exercise 4Exercise 5Exercise 6