Giter Site home page Giter Site logo

mcfongtw / flink-cassandra-connector-examples Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 81 KB

Examples of performing streaming computation with flink and storing result to C* as sink.

License: Apache License 2.0

Java 93.63% Scala 6.37%
flink cassandra

flink-cassandra-connector-examples's Introduction

Welcome!

This repository includes several examples of performing streaming computation with Flink and storing result to C*.

Any comments, feedback or pull requests are welcome!

Motivation

A short description of the motivation behind the creation and maintenance of the project. As this project was created, as of Flink version 1.4.0, there are plenty streaming examples and a few simple C* connector examples. However, there are currently no concrete examples that demonstrates on storing streaming results to C* using flink-connector-cassandra library.

Included Examples

  1. The streaming examples could be found at org.apache.flink.connectors.cassandra.streaming.
  2. The associated CQL entity mapping is located at org.apache.flink.connectors.cassandra.datamodel

Examples Overview

Here is the quick overview for each examples

Name Language Type Computation Type Data Type CQL Entity
WikiAnalysis Java Streaming POJO WikiEditRecord
FileWordCount Java Streaming Java Tuple WordCount
FileWordCount Java Batch Java Tuple WordCount
SocketWindowWordCount Java Streaming POJO WordCount
SocketWindowWordCount Java Streaming Java Tuple WordCount
SocketWindowWordCount Scala Streaming Scala Tuple WordCount

Description

WikiAnalysis

org.apache.flink.connectors.cassandra.streaming.pojo.wiki.WikiAnalysis

An implementation to stream all edited record from Wikipedia to Flink and count the number of bytes that each user edits within a given window of time This example utilizes POJO data type to perform the stream computation and store the result back to C* with CQL entity WikiEditRecord

FileWordCount

  1. Streaming example: org.apache.flink.connectors.cassandra.streaming.tuple.wordcount.FileWordCount
  2. Batch example: org.apache.flink.connectors.cassandra.batch.tuple.wordcount.FileWordCount

A re-implementation of the "WordCount" program that computes a simple word occurrence histogram over text files in a streaming fashion. This example utilizes Tuple data type to perform the stream computation and store the result back to C* with CQL entity WordCount

SocketWindowWordCount

  1. Java Pojo example: org.apache.flink.connectors.cassandra.streaming.pojo.wordcount.SocketWindowWordCount
  2. Java Tuple example: org.apache.flink.connectors.cassandra.streaming.tuple.wordcount.SocketWindowWordCount
  3. Scala Tuple example: org.apache.flink.connectors.cassandra.scala.streaming.tuple.wordcount.SocketWindowWordCount

An re-implementation to connects to a server socket, reads strings from the socket, perform word count against the text recieved and finally store the result back to C* with CQL entity WikiEditRecord. Several implementations exists, some for streaming over Java/Scala tuple data type, and the others for Java POJO type.

Common Services

Embedded Cassandra Service

A embedded C* service is provided that is convenient for testing and demonstration purposes. This embedded C* instance will live with JVM process and stores data at a directory created randomly upon bootstrap under /tmp.

Library Dependency

Here are the foundemental libraries used in this project, and those information could also be found in pom.xml

  1. Apache Flink - Version 1.4.0
  2. Apache Cassandra - Version 2.2.5
  3. DataStax Java Driver - Version 3.0.0

How to Build Examples

Type the following maven command in console shell

  1. mvn clean package for an executable fat-jar, or
  2. mvn clean package -Pbuild-jar for an executable uber jar with cleaner dependencies.

Acknowledgement

This project is based on the QuickStart Project from Apache Flink Guide, in which most of libraries dependencies and Maven settings remain. In addition, most of the examples could also be found from Apache Flink project (without storing the result to C* sink, of course).

flink-cassandra-connector-examples's People

Contributors

mcfongtw avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

daviddingly

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.