Screenshot of the FileTailer Information Model in SMARTUNIFIER¶
Structure of the Information Model for the File Tailer Channel
Event:
The event specified in the Information Model for the File Tailer will serve as a trigger in the Mapping.
When a new line in the CSV file is detected by SMARTUNIFIER the associated rule will be executed.
Variables:
Variables defined within the Event represent the values in the same order as defined in the CSV-file.
The group function allows you to combine logical entities into paths. You can use existing naming conventions and styles for naming equipment to organize the configuration components. This simplifies the structuring and management of configurations.
Hint
We recommend using a consistent “Group” name throughout the demo. For instance, to identify the artifacts created for this scenario, the group name “demo.csv-rest” is used.
There must be a second Information Model, for the REST-Server.
Create an Information Model that represents the structure of the data on the REST server.
Screenshot of the REST server Information Model in SMARTUNIFIER¶
Structure of the Information Model for the REST server:
Variables
The variable Data which is defined as a custom data type represents a data object on the Rest server. By invoking Data, we can conveniently access all associated variables at once, rather than retrieving each individually.
The individual variables nested within Data specifically represent the actual values.
To create the Mapping we need to proceed with the steps outlined below:
1. Create the Mapping:
Enter the group name: demo.csv-rest
Enter a name: e.g. CsvDataToRest
Add the Information Models form earlier:
demo.csv-rest.FileTailer
demo.csv-rest.RestServer
Hint
You can enter for each Information Model a short name which is used within the Rule to access all elements of the specific Information Model e.g. csv and rest.
2. Create a Single Rule that defines the Mapping between the File Tailer and the Rest Server Information Model.
a. Enter a Rule Name e.g. CsvToRest.
b. Drag and drop the CsvData Event from the File Tailer Information Model into the trigger field.
c. Drag and drop the Data variable from the Rest Server Information Model into the actions panel. Make sure to choose the Complex assignment type.
d. Assign to each target element the appropriate source element:
Because we have different data types for the source and the target Information Model we have to use the following code constructs:
To convert the String variables Temperature and Pressure to double, we can use toDouble(definition: TVariableDefinition[T]):
Deployments are described in the chapter Deployment.
To deploy our Communication Instance we need to proceed with the steps outlined below:
1. Select the Local Deployment
2. Select the Instance, the Endpoint default:Default and Info for the level of detail of the log (We can leave the other configuration at their default value for this demo).
3. Save the Deployment.
4. Now Deploy and Start the Instance.
Screenshot of a deployed Instance in SMARTUNIFIER¶