Microservice developed using Java 13, Spring Boot 2 and Docker. It creates a warning alarm message (for demonstration purposes) and it exposes endpoints to:
- Verify if the microservice is up and running.
- Pass a parameter to the platform and return a formatted string.
- Get some of the environment variables and the microservice service settings.
- Track a user's approximate location and store it in the platform.
- Get the tracked IPs and locations.
It also uses the Cumulocity IoT UI to display the tracked locations on a map.
- Cumulocity IoT credentials (tenant, user and password). Create a free trial at the Cumulocity IoT website.
- Docker local installation.
- A managed object (device ID) in Cumulocity IoT.
- A key from ipstack.
Set the device ID and ipstack key in the manifest file (cumulocity.json).
For more details, review the full tutorial of the Java microservice in the online guides.
Use the command mvn clean install
to create a packed Docker microservice as a ZIP file and upload it to the Cumulocity IoT platform. For more details about uploading a microservice ZIP file, refer to Managing applications > Adding own applications under the Administration section in the User guide.
A GET request on location/track will obtain the client's IP from the request header and use the createLocationUpdateEvent
method to get the approximate location.
In the Device Management application, navigate to Devices > All devices and locate the microservice tracker. A map with the tracked locations can be seen under Tracking.