Giter VIP home page Giter VIP logo

cpmtask's Introduction

Geiger Counter Spring App From the Edge

  1. Build each stream application in the Stream Application section.

  2. Build Task Application

  3. Create the table required for the demo by executing the scripts in the Setup DB section.

  4. Build and launch the sensor application as show below.

  5. Use your Database client to see the data appear in the bananas table.

Stream Applications

Banana Alert Application

Build the application

cd BananaAlert
mvn clean install -DskipTests

Docker Build

mvn dockerfile:build
Note
If you are using minikube be sure to execute this command prior to the docker build, eval $(minikube docker-env).

To setup a slack channel for alerts using web-hooks follow the instructions here.

Filter Bad CPM data App

Build the application

cd filterbadcpm
mvn clean install -DskipTests

Docker Build

mvn dockerfile:build
Note
If you are using minikube be sure to execute this command prior to the docker build, eval $(minikube docker-env).

Transform CPM data to SensorData Application

Build the application

cd transformcpm
mvn clean install -DskipTests

Docker Build

mvn dockerfile:build
Note
If you are using minikube be sure to execute this command prior to the docker build, eval $(minikube docker-env).

Setup DB

From a Database client execute the following DDL to create the table for storing banana info

drop table bananas;
CREATE TABLE bananas
(
	countsPerMinute INTEGER NOT NULL,
	microSieverts double,
	bananas double,
	unitId varchar(255),
	timestamp varchar(255)
);

Task Applications

Log Banana Average Application

Build the application

cd logbananaaverage
mvn clean install -DskipTests

Docker Build

mvn dockerfile:build
Note
If you are using minikube be sure to execute this command prior to the docker build, eval $(minikube docker-env).

Register the apps

If running the streams locally

From the Spring Cloud Data Flow Shell

app register --name filteroutbadcpm --type processor --uri maven://io.spring:filterbadcpm:1.0.0.BUILD-SNAPSHOT
app register --name transformcpm --type processor --uri maven://io.spring:transformcpm:1.0.0.BUILD-SNAPSHOT
app register --name alertsink --type sink --uri maven://io.spring:bananaalert:1.0.0.BUILD-SNAPSHOT
app register --name logbananaaverage --type task --uri maven://io.spring:logbananaaverage:1.0.0.BUILD-SNAPSHOT

If running the streams from kubernetes or a docker instance

app register --name filteroutbadcpm --type processor --uri docker:cppwfs/filterbadcpm:1.0.0.BUILD-SNAPSHOT
app register --name transformcpm --type processor --uri docker:cppwfs/transformcpm:1.0.0.BUILD-SNAPSHOT
app register --name alertsink --type sink --uri docker:cppwfs/bananaalert:1.0.0.BUILD-SNAPSHOT
app register --name logbananaaverage --type task --uri docker:cppwfs/logbananaaverage:1.0.0.BUILD-SNAPSHOT

Create the streams

stream create --name edgeinput --definition "http --server.port=9000 > :storestream"
stream create --name iotinput --definition "http --server.port=9001 | transformcpm > :storestream"
stream create --name storedata --definition ":storestream > filteroutbadcpm | jdbc --tableName=bananas --columns=countsPerMinute,microSieverts,bananas,unitId,timestamp --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver --spring.datasource.url='jdbc:mysql://<URL>/<DB>' --spring.datasource.username=<user> --spring.datasource.password=<password>"
stream create --name alertstream --definition ":storedata.filteroutbadcpm > alertsink  --slackURL=your web hook url"

Sensor Application

Build the application

cd sensorapp
mvn clean install -DskipTests

Run the Sensor application to generate sample data

cd sensorapp
java -jar target/sensorapp-0.0.1-SNAPSHOT.jar --generateSampleData=true --url=http://<your http source>

Run the Sensor application with real data to cloud

cd sensorapp
java -jar target/sensorapp-0.0.1-SNAPSHOT.jar --url=<your http source>

cpmtask's People

Contributors

royclarkson avatar

Watchers

 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.