Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dariuszzbyrad/mat-coding-challenge-solution
https://github.com/dariuszzbyrad/mat-coding-challenge-solution
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dariuszzbyrad/mat-coding-challenge-solution
- Owner: dariuszzbyrad
- Created: 2019-04-29T06:47:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-23T09:55:10.000Z (over 5 years ago)
- Last Synced: 2024-10-19T12:44:33.742Z (3 months ago)
- Language: Java
- Size: 204 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MAT Fan Engagement Coding Challenge
## Prerequisites:
* [docker](https://docs.docker.com/)
* [docker-compose](https://docs.docker.com/compose/)## Introduction
The purpose of this challenge is for you to demonstrate
* write and structure a simple backend application in an appropriate language of your choice
* parse and transform streamed telemetry data
* deliver a component to integrate into a stack of technologiesFeel free to use any libraries, frameworks or dependencies you want in order to achieve the task.
Please include instructions on how to build and run your code, any tests you've written and some text explaining what you did.
If you are already familiar with the underlying technologies we hope that it won't take you more than a couple of hours to get your application up and running.
## Scenario
Real-time data from a Formula 1 race has been recorded and streamed into our system. We want to use that data in order to increase fan engagement by providing a live visualisation.
## Challenge
Raw telemetry data is arriving via MQTT. A basic front-end application has been developed to visualise F1 cars going around a track. It can also display an event stream and car status information such as speed and position, but currently it is not receiving this information.
Please develop a data processing application which subscribes to the provided MQTT broker and consumes data from the following MQTT topic with the format shown:
* **carCoordinates**
```console
{
timestamp: number,
carIndex: number,
location: {
lat: float,
long: float
}
}
```e.g.
```json
{
"timestamp": 1541693114862,
"carIndex": 2,
"location": {
"lat": 51.349937311969725,
"long": -0.544958142167281
}
}
```It should then publish aggregated and enriched data on the following MQTT topics using the format described:
- **carStatus**
```console
{
timestamp: number,
carIndex: number,
type: string,
value: number
}
```e.g.
```json
{
"timestamp": 1541693114862,
"carIndex": 2,
"type": "POSITION",
"value": 1
}
```- **events**
```console
{
timestamp: number,
text: string
}
```e.g.
```json
{
"timestamp": 1541693114862,
"text": "Car 2 races ahead of Car 4 in a dramatic overtake."
}
```All these topics will then be forwarded via a gateway-like MQTT-to-WebSocket service to the frontend application.
## Architecture
![Components](./components.svg)
## Getting started
Start all components:
```console
$ docker-compose pull
$ docker-compose up -d
Creating network "mat-coding-challenge_default" with the default driver
Creating broker ... done
Creating source_gps ... done
Creating mqtt-to-websocket ... done
Creating webapp ... done
```Open (http://localhost:8084)
Test the setup with `mosquitto_pub` or a similar MQTT client:
```console
$ mosquitto_pub -t events -f examples/event.json
$ mosquitto_pub -t carStatus -f examples/status.json
```You should now see a car's position and an event in the webapp.
## Run solution
```console
$ cd processor && ./mvnw verify jib:dockerBuild
$ docker-compose up -d
```