https://github.com/manasesjesus/c8y_microservice-java
Cumulocity IoT - Microservice developed using Java 13, SpringBoot 2 and Docker. Tracks a user's approximate location and shows it in a Cumulocity map.
https://github.com/manasesjesus/c8y_microservice-java
cumulocity-iot docker iot-platform location-tracking microservice spring-boot
Last synced: 7 months ago
JSON representation
Cumulocity IoT - Microservice developed using Java 13, SpringBoot 2 and Docker. Tracks a user's approximate location and shows it in a Cumulocity map.
- Host: GitHub
- URL: https://github.com/manasesjesus/c8y_microservice-java
- Owner: manasesjesus
- License: mit
- Created: 2019-02-21T16:40:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-08-12T15:07:04.000Z (about 3 years ago)
- Last Synced: 2025-01-22T14:34:36.570Z (9 months ago)
- Topics: cumulocity-iot, docker, iot-platform, location-tracking, microservice, spring-boot
- Language: Java
- Homepage:
- Size: 813 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Cumulocity IoT Microservice
[](https://app.codacy.com/app/manasesjesus/c8y_hw_microservice_java?utm_source=github.com&utm_medium=referral&utm_content=manasesjesus/c8y_hw_microservice_java&utm_campaign=Badge_Grade_Dashboard)
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.
### Prerequisites
* Cumulocity IoT credentials (tenant, user and password). Create a free trial at the [Cumulocity IoT](https://cumulocity.com/) website.
* Docker local installation.
* A managed object (device ID) in Cumulocity IoT.
* A key from [ipstack](https://ipstack.com).### Setup
Set the device ID and ipstack key in the manifest file (_cumulocity.json_).
For more details, review the full tutorial of the [Java microservice](https://cumulocity.com/guides/microservice-sdk/http/#microservice-java) in the online guides.### Build and deploy
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](/guides/users-guide/administration#adding-applications) under the Administration section in the User guide.
### Execution
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**.
