Url: https://api.triangl.io/tracking-ingestion-service/
Full API Documentation: https://api.triangl.io/tracking-ingestion-service/swagger-ui.html
Place in the Infrastructure: https://github.com/codeuniversity/triangl-infrastructure
For faster development this service currently combines the Computation and the Ingestion Service that we want to have seperate in the later stage
- Send one DataPoint POST /tracking
- Send multiple DataPoints POST /tracking/multiple
- Get Routers lastSeen Timestamp GET /routers/lastSeen
- Read the buffer GET /read
This Service is an Endpoint for the Routers to send their DataPoints to. These DataPoints currently look the like the following:
{
var routerId: "TheRouterId",
var deviceId: "TrackedDeviceId",
timestampString: "2018-10-15 09:00:00", //GMT+00:00
var signalStrength: -255
}
The service then:
- calculates the location of the TrackedDevice,
- hashes the Mac Address
- inserts it into the Google Datastore
- notifies the Pipeline over Google Pub/Sub about the new Tracking Point in the Datastore.
The Pipeline can then apply the changes to the Serving SQL Database.
The location calculation function works in the following way:
It starts in a second kotlin coroutine and then checks every 5 seconds if there are some locations to compute.
The computation currently works based on the RSSI (Received Signal Strength Indication). The location of the TrackedDevice is currently the location of the nearest router that tracked him. Lateration is currently still work in Progress.
- Objectify https://github.com/objectify/objectify Used to connect and write to Google Datastore. "Objectify is a Java data access API specifically designed for the Google Cloud Datastore"
The following Environment variables are need for this service:
GOOGLE_APPLICATION_CREDENTIALS:{pathToGoogleKeyFile.json}
mac.salt:{your-salt-for-hashing}
mac.pepper:{your-pepper-for-hashing}
Be aware that salt and pepper can't change once some DatabaseEntries are created with it.
Moreover, you can set the pubsub.topicId
env variable via the console
to override the standard value pubsub.topicId=test
.
-
With Gradle
GOOGLE_APPLICATION_CREDENTIALS=/path/to/google/key/file.json mac.salt:{your-salt-for-hashing} mac.pepper:{your-pepper-for-hashing} ./gradlew bootRun