Use Flink's Stateful Functions as a control-plane technology for operating a streaming-platform

Overview

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
You might also like...
Animated tabbar with native control
Animated tabbar with native control

SSCustomBottomNavigation Getting Started SSCustomBottomNavigation is a customizable bottom bar library with curved animations. The actual features are

A simple xposed module that helps you fully control your location.

FuckLocation An simple xposed module that helps you fully control your location. 一个可以帮助你完全控制位置授权的模块 Currently, you may return custom location to speci

AndroRAT is a tool designed to give the control of the android system remotely and retrieve informations from it.
AndroRAT is a tool designed to give the control of the android system remotely and retrieve informations from it.

AndroRAT is a tool designed to give the control of the android system remotely and retrieve informations from it. Androrat is a client/server application developed in Java Android for the client side and the Server is in Python.

Parking Robot based on 3D LiDAR. Keywords: Automatic Parking, SLAM, 3D Navigation, Remote Control, ROS, RRT
Parking Robot based on 3D LiDAR. Keywords: Automatic Parking, SLAM, 3D Navigation, Remote Control, ROS, RRT

ELEC3875-Final-Project My undergraduate final project: Parking Robot based on 3D LiDAR. ELEC3875 / XJEL3875 Keywords: Automatic Parking, SLAM, 3D Navi

Lightweight compiler plugin intended for Kotlin/JVM library development and symbol visibility control.

Restrikt A Kotlin/JVM compiler plugin to restrict symbols access, from external project sources. This plugin offers two ways to hide symbols: An autom

This Project for how to use  MVVM , state flow, Retrofit, dagger hit, coroutine , use cases with Clean architecture.
This Project for how to use MVVM , state flow, Retrofit, dagger hit, coroutine , use cases with Clean architecture.

Clean-architecture This Project for how to use MVVM , state flow, Retrofit, dagger hit, coroutine , use cases with Clean architecture. Why i should us

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Codename One - Cross Platform Native Apps with Java or Kotlin Codename One is a mobile first cross platform environment for Java and Kotlin developers

A Bluetooth kotlin multiplatform "Cross-Platform" library for iOS and Android

Blue-Falcon A Bluetooth "Cross Platform" Kotlin Multiplatform library for iOS, Android, MacOS, Raspberry Pi and Javascript. Bluetooth in general has t

Free & Open-Source External Scripting Platform
Free & Open-Source External Scripting Platform

LeagueOfJire Free & Open-Source External Scripting Platform What features does this have? All of the feature's source-code can be found in the userscr

Owner
Dylan Meissner
Dylan Meissner
A unique technology modification ported from Forge to Fabric.

Fracdustry Reimagined >> Download << Thank you, MikhailTapio. This mod is open source and under a permissive license. As such, it can be included in a

Team (Another) Fractal 3 Dec 18, 2021
Android-Boilerplate - Base project for android development with new technology

Android-Boilerplate Base project for android development with new technology, in

Muhammad Rizky Arifin 1 Aug 15, 2022
A movie and TV Show streaming mobile app built with Jetpack Compose.

PhotoPlay A movie and TV Show streaming mobile app in Android built using Jetpack compose. This project is developed by Javokhir Savriev for more proj

Javokhir 4 Nov 9, 2022
Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.

Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.

Chris Russell 1 Feb 11, 2022
A collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android.

requireKTX requireKTX is a collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android, using the sam

Márton Braun 82 Oct 1, 2022
A kotlin library of extension functions that add smalltalk style methods to objects.

KtTalk A kotlin library of extension functions that add smalltalk style methods to objects. Motivation Smalltalk is a pure OO language in which everyt

null 11 Oct 16, 2021
Extension functions over Android's callback-based APIs which allows writing them in a sequential way within coroutines or observe multiple callbacks through kotlin flow.

callback-ktx A lightweight Android library that wraps Android's callback-based APIs into suspending extension functions which allow writing them in a

Sagar Viradiya 171 Oct 31, 2022
A library provides some useful kotlin extension functions

ktext ?? A library provides some useful kotlin extension functions. Including in your project Gradle Add below codes to your root build.gradle file (n

热心市民苏苏仔 76 Oct 26, 2022
Muhammad Ariananda 7 Jul 17, 2022
ListUtil.kt ListUtils - Advance list functions from kotlin standard library

ListUtils - Advance list functions from kotlin standard library A set of utility functions to work with lists in a robust way. It is based on a patter

Zain Ul Hassan 1 May 6, 2022