MOD23: Register itself at the OI4 Service Registry - GoranErdeljan/TINF19C-Team-4-Service-Registry GitHub Wiki
Created by Benedict Wetzel
1. Introduction
This module can be used to publish information about the service on the MQTT-Broker and by doing so register it at the OI4-Service-Registry.
2. Requirements
The following requirements are covered by this module:
3. Prerequisites
In order to use this module the following prerequisites should be met:
- The developer should have a working computer that can access the internet
- The developer should use a Linux-based OS
- The developer should have Node.js version 12.14.1 or higher installed
- The developer should have NPM version 7.10.0 or higher installed
- The developer should have at least some basic experience with Node.js
4. Dependencies
This module depends on the following items:
5. Technical overview
This module has the functionality to publish information about the service on the MQTT-Broker. It is able to listen to requests that concern the service and answer them respectively.
registeratOI4.js
5.1This file contains all functionality of the module. It depends on the mqttjs NPM package.
Function | Description |
---|---|
setConfig | Sets the configuration of this module. Should be called before start. |
start | This function starts the module. It subscribes to the topic on the MQTT-Broker, where all messages concerning this service are published. It then registers a ebent handler that listens to those messages and replies to them using the following functions. It also publishes Health-Messages every sixty seconds, as specified by the OI4. |
pubHealth | This function is used to publish responses to Health-requests concerning the service on the MQTT-Broker |
pubProfile | This function is used to publish responses to Profile-requests concerning the service on the MQTT-Broker |
pubLicense | This function is used to publish responses to License-requests concerning the service on the MQTT-Broker |
pubLicenseText | This function is used to publish responses to LicenseText-requests concerning the service on the MQTT-Broker |
pubConfig | This function is used to publish responses to Config-requests concerning the service on the MQTT-Broker |
pubPublicationList | This function is used to publish responses to PublicationList-requests concerning the service on the MQTT-Broker |
buildmammessage | Builds the payload of the message which is used to publish the Master-Asset-Model of the service on the MQTT-Broker |
buildmsg | Builds an OI4 compliant message which can then be published on the MQTT-Broker. |
package.json
5.2Sets the dependencies and is used by NPM to install the required NPM packages.