Skip to content

manasesjesus/c8y_microservice-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cumulocity IoT Microservice

Codacy Badge

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 website.
  • Docker local installation.
  • A managed object (device ID) in Cumulocity IoT.
  • A key from ipstack.

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 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 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.

Microservice tracking

About

Cumulocity IoT - Microservice developed using Java 13, SpringBoot 2 and Docker. Tracks a user's approximate location and shows it in a Cumulocity map.

Topics

Resources

License

Stars

Watchers

Forks

Languages