Code Monkey home page Code Monkey logo

spark-structured-streaming's Introduction

This is an example of structured-streaming with latest Spark v2.1.0.

A spark job reads from Kafka topic, manipulates data as datasets/dataframes and writes to Cassandra.

Usage:

  1. Inside setup directory, run docker-compose up -d to launch instances of zookeeper, kafka and cassandra

  2. Wait for a few seconds and then run docker ps to make sure all the three services are running.

  3. Then run pip install -r requirements.txt

  4. main.py generates some random data and publishes it to a topic in kafka.

  5. Run the spark-app using sbt clean compile run in a console. This app will listen on topic (check Main.scala) and writes it to Cassandra.

  6. Again run main.py to write some test data on a kafka topic.

  7. Finally check if the data has been published in cassandra.

  • Go to cqlsh docker exec -it cas_01_test cqlsh localhost
  • And then run select * from my_keyspace.test_table ;

Credits:

  • This repository has borrowed some snippets from killrweather app.

spark-structured-streaming's People

Contributors

ansrivas avatar

Watchers

Sathish K Vairavelu 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.