Giter VIP home page Giter VIP logo

statefun-ops's Introduction

statefun-ops

Use ๐ŸŒฐ Flink Stateful Functions as a control-plane technology for operating a streaming-platform based on Apache Kafka.

Walkthrough

  • Ensure Protobuf and kafka-python is installed: pip3 install -r requirements.txt
  • Run docker-compose up --detach to start the infrastructure
  • Run gradle run to start the embedded Stateful Functions application

To follow the events egress, open a new terminal in the same directory and run: python3 ./consumer.py events

To follow the snapshots egress, open a new terminal in the same directory and run: python3 ./consumer.py snapshots

Open a new terminal in the same directory, then:

  • To add a topic, run python3 ./harness.py add-topic hello-stream
  • To add a user, run python3 ./harness.py add-user wandering-squirrel
  • To add a credential, run python3 ./harness.py add-credential wandering-squirrel 5m

Your new credential will expire in 5 minutes. However, a user can have multiple credentials.

Using your new credential, list topics, produce, and consume from Kafka using kafkacat:

  • To list topics, run kafkacat -b localhost:9092 -X security.protocol=SASL_PLAINTEXT -X sasl.mechanism=SCRAM-SHA-256 -X sasl.username=<credential identifier> -X sasl.password=statefun -L
  • To produce to a topic, run echo "hello" | kafkacat -b localhost:9092 -X security.protocol=SASL_PLAINTEXT -X sasl.mechanism=SCRAM-SHA-256 -X sasl.username=<credential identifier> -X sasl.password=statefun -P -t hello-stream
  • To consume from a topic, run kafkacat -b localhost:9092 -X security.protocol=SASL_PLAINTEXT -X sasl.mechanism=SCRAM-SHA-256 -X sasl.username=<credential identifier> -X sasl.password=statefun -C -t hello-stream -o beginning -e

To cleanup, remove your credentials, users, and topics.

  • To revoke a credential, run python3 ./harness.py revoke-credential <credential identifier>
  • To remove a user, run python3 ./harness.py remove-user wandering-squirrel
  • To remove a topic, run python3 ./harness.py remove-topic hello-stream
  • Finally, stop the infrastructure: docker-compose down

statefun-ops's People

Contributors

dylanmei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.