TLDR; Watch Linux Tutorial Setup on YouTube
Tutorial Purpose: Create an Orchestrator OpenHIM Mediator registered with your local OpenHIM instance that illustrates how to implement your own custom mediator logic.
In this tutorial we will be designing an orchestrator mediator that will accept a request from the client for a list of Health Facilities. In our example, the client wants the facility list in JSON format. DHIS2 is the source of our facility data and in this example only provides the data in XML. Therefore, our mediator will have to translate the data from XML into JSON before sending the response back to the client.
- NodeJS and NPM
This tutorial assumes you've setup the OpenHIM and understand the basics of an openHIM Mediator.
To keep the two mediators from conflicting, the first thing we need to change for the orchestrator is the port numbers. Let's configure the
Orchestrator to expose port 3001 instead of 3000 so that the two mediators can run at the same time. The files that set the port numbers are:
The last change is in the mediatorConfig.json and package.json files. Where ever the word scaffold was used replace this with orchestrator. Your
mediatorConfig file should now resemble this:
Test the new project by building the image, get the docker network name, and start the container:
Open up the OpenHIM Console Mediators page in a browser and you should see your new mediator listed.
Important mediator changes are indicated in the following image. Once your orchestrator mediator is properly configured click the green Add channel button in the bottom right corner.
On the OpenHIM Console Channels page you should see your new orchestrator channel.
Click the yellow edit channel icon to view details of the channel. Go to the Route tab and check that the host value is
orchestrator and the port is 3001.