An OpenHIM mediator for handling system integrations with DHIS2.
- Java 1.8
- IntelliJ or Visual Studio Code
- Maven 3.6.3
This mediator is designed to work with multiple systems that do not require any message transformations or any data validation to the message payload to DHIS2. The mediator handles processing of DHIS2 response messages, in cases that DHIS2 responds with HTTP status code 200 while some data had failed during processing, before sending the response to HIM.
The configuration parameters specific to the mediator and destination system can be found at
src/main/resources/mediator.properties
mediator.name=eLMIS-to-DHIS2-Mediator
mediator.host=localhost
mediator.port=3031
mediator.timeout=60000
mediator.heartbeats=true
core.host=localhost
core.api.port=8080
[email protected]
core.api.password=openhim-password
destination.host=localhost
destination.api.port=8080
destination.api.path=/destination-system-path
destination.scheme=http
The configuration parameters specific to the mediator and the mediator's metadata can be found at
src/main/resources/mediator-registration-info.json
{
"urn": "urn:uuid:c11b99a0-d8af-11eb-badb-9d2a2a013a07",
"version": "0.1.0",
"name": "eLMIS - DHIS2 Mediator",
"description": "An openHIM mediator for handling system integration between eLMIS and DHIS2",
"endpoints": [
{
"name": "eLMIS to DHIS2 Mediator Route",
"host": "localhost",
"port": "3031",
"path": "/dhis2",
"type": "http"
}
],
"defaultChannelConfig": [
{
"name": "eLMIS to DHIS2 Mediator",
"urlPattern": "^/dhis2$",
"type": "http",
"allow": ["elmis-role"],
"routes": [
{
"name": "eLMIS - DHIS2 Mediator Route",
"host": "localhost",
"port": "3031",
"path": "/dhis2",
"type": "http",
"primary": "true"
}
]
}
],
"configDefs": [
{
"param": "destinationConnectionProperties",
"displayName": "Destination Connection Properties",
"description": "Configuration to set the hostname, port and path for the destination server",
"type": "struct",
"template": [
{
"param": "destinationHost",
"displayName": "Destination Host Name",
"description": "IP address/hostname of the destination server. e.g 192.168.1.1",
"type": "string"
},
{
"param": "destinationPort",
"displayName": "Destination Port Number",
"description": "The port number of the destination server. e.g 8080",
"type": "number"
},
{
"param": "destinationPath",
"displayName": "Destination Path",
"description": "The destination path",
"type": "string"
},
{
"param": "destinationScheme",
"displayName": "Destination Scheme",
"description": "Whether the destination is using HTTP or HTTPS requests.",
"type": "option",
"values": [
"http",
"https"
]
},
{
"param": "destinationUsername",
"displayName": "Destination Username",
"description": "The destination username for receiving data from the HIM.",
"type": "string"
},
{
"param": "destinationPassword",
"displayName": "Destination Password",
"description": "The destination password for receiving data from the HIM.",
"type": "password"
}
]
}
]
}
To build and run the mediator after performing the above configurations, run the following
mvn clean package -DskipTests=true -e source:jar javadoc:jar
java -jar target/dhis2-mediator-<version>-jar-with-dependencies.jar