Crosser + UNS - Expose data via HTTP
Using MQTT as the foundation for your UNS provides a robust publish/subscribe model for data exchange. However, if a client or application needs to query specific data points on demand, Crosser can act as a ‘wrapper’ around your UNS. This setup allows you to send HTTP requests to Crosser, which then retrieves the requested data from the UNS.
To achieve this you first have to make sure that the data which you want to expose via HTTP is available in memory (Key/Value Store). You can subscribe via wildcard to all topics on the UNS, use the string replace to replace ‘ / ’ with ‘ . ‘ . The Key/Value store modules can nowadays deal with hierarchical information like ‘stockholm.packaging.line1.cellA.Conveyor1’ and can therefore store and query nested objects.
Once that is done use the HTTP Listener module in combination with the HTTP Response module to build and end-to-end flow that fetches data from the Key/Value store based on the query (GET), checks if the query was successful, maps the data into proper response body and sends it back to the requester client.
As a result you can use regular HTTP applications to query data from your UNS.