Git Product home page Git Product logo

iot-spark-rest's Introduction

IOT data processing with Spark

Simple example for IOT processing. It collects json data from vehicles, it publishes to Kafka, Spark aggregates the data and sends it to a REST service.

  --------------------        --------        ----------        ---------
 |                    |      |        |      |          |      |         |
 | PublishMessagesApp | ---> |   ZK   | ---> | SparkApp | ---> | RestApp |
 |  VehicleData json  |      | Kafka  |      |          |      | Counter |
 |                    |      |        |      |          |      |         |
  --------------------        --------        ----------        ---------

Modules

iot-data

This module is shared with the rest of the modules, it provides the scala model of the VehicleData and SummaryData. Also provides a utility to convert model to json format and vice versa. In the test resources I was reusing some of my cycling activities recorded with a GPS device to generate test input for Kafka.

kafka-producer

It creates the topic if doesn't exists yet and it will publish VehicleData in json format to the Kafka broker. To have a fully functional setup I was using spotify/kafka Docker image to run the broker locally on my computer. Run it as: iot.publish.PublishMessagesApp

rest-service

It exposes the 'summary' endpoint via a rest service. It logs the incoming messages (SummaryData type) and counts them. If you hit localhost:8888 on the browser, the GET will response with the value of the counter. Run it as: RestApp

spark-processor

It reads the input messages from the kafka topic as a stream and it processes it. The results are posted to a REST service running locally. The default values (e.g. iot.kafka.topic, iot.rest.endpoint) can be overridden via system properties. Run it as: iot.spark.SparkApp

iot-spark-rest's People

Contributors

peregin avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.