Coder Social home page Coder Social logo

dannyb2018 / kafka-streams-dotnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lgouellec/streamiz

0.0 2.0 0.0 893 KB

.NET Stream Processing Library for Apache Kafka ๐Ÿš€ /*** WORK IN PROGRESS ***/

License: MIT License

C# 100.00%

kafka-streams-dotnet's Introduction

.NET Stream Processing Library for Apache Kafka TM ยท GitHub license build

Sonarcloud statistics

Sonar Cloud Quality Gate Sonar Cloud Quality Gate Sonar Cloud Reliability Rate Sonar Cloud Security Rate Sonar Cloud Maintainability Rate Sonar Cloud Duplicated Code

GitHub statistics

GitHub issues GitHub pull requests


Streamiz Kafka .NET is .NET stream processing library for Apache Kafka.

It's allowed to develop .NET applications that transform input Kafka topics into output Kafka topics. It's supported .NET Standard 2.1.

It's a rewriting inspired by Kafka Streams.

Finally it will provide the same functionality as Kafka Streams.

At moment, this project is being written. Thanks for you contribution !

Usage

Sample code

static void Main(string[] args)
{
    CancellationTokenSource source = new CancellationTokenSource();
    
    var config = new StreamConfig<StringSerDes, StringSerDes>();
    config.ApplicationId = "test-app";
    config.BootstrapServers = "192.168.56.1:9092";
    config.SaslMechanism = SaslMechanism.Plain;
    config.SaslUsername = "admin";
    config.SaslPassword = "admin";
    config.SecurityProtocol = SecurityProtocol.SaslPlaintext;
    config.AutoOffsetReset = AutoOffsetReset.Earliest;
    config.NumStreamThreads = 2;
    
    StreamBuilder builder = new StreamBuilder();

    builder.Stream<string, string>("test")
        .FilterNot((k, v) => v.Contains("test"))
        .Peek((k,v) => Console.WriteLine($"Key : {k} | Value : {v}"))
        .To("test-output");

    builder.Table("topic", InMemory<string, string>.As("test-ktable-store"));

    Topology t = builder.Build();
    KafkaStream stream = new KafkaStream(t, config);

    Console.CancelKeyPress += (o, e) => {
        source.Cancel();
        stream.Close();
    };

    stream.Start(source.Token);
}

Timeline

  • End May 2020 - Beta 0.0.1 - All stateless processors, Exactly Once Semantic, InMemory store
  • End October 2020 - Beta 0.0.2 - All statefull processors, Global Store, RocksDB Store
  • End 2020 / Begin 2021 - 1.0.0 RC1 - Processor API, Metrics, Interactive Queries

Stateless processor implemention

Operator Name Method TODO IMPLEMENTED TESTED DOCUMENTED
Branch KStream -> KStream[] โ˜‘
Filter KStream -> KStream โ˜‘
Filter KTable -> KTable โ˜‘
InverseFilter KStream -> KStream โ˜‘
InverseFilter KTable -> KTable โ˜‘
FlatMap KStream โ†’ KStream โ˜‘
FlatMapValues KStream โ†’ KStream โ˜‘
Foreach KStream โ†’ void โ˜‘
GroupByKey KStream โ†’ KGroupedStream โ˜‘
GroupBy KStream โ†’ KGroupedStream โ˜‘
GroupBy KTable โ†’ KGroupedTable โ˜‘
Map KStream โ†’ KStream โ˜‘
MapValues KStream โ†’ KStream โ˜‘
MapValues KTable โ†’ KTable โ˜‘
Peek KStream โ†’ KStream โ˜‘
Print KStream โ†’ void โ˜‘
SelectKey KStream โ†’ KStream โ˜‘
Table to Steam KTable โ†’ KStream โ˜‘

Statefull processor implementation

Operator Name Method TODO IMPLEMENTED TESTED DOCUMENTED
Aggregate KGroupedStream -> KTable โ˜‘
Aggregate KGroupedTable -> KTable โ˜‘
Aggregate(windowed) KGroupedStream -> KTable โ˜‘
Count KGroupedStream -> KTable โ˜‘
Count KGroupedTable -> KTable โ˜‘
Count(windowed) KGroupedStream โ†’ KStream โ˜‘
Reduce KGroupedStream โ†’ KTable โ˜‘
Reduce KGroupedTable โ†’ KTable โ˜‘
Reduce(windowed) KGroupedStream โ†’ KTable โ˜‘
InnerJoin(windowed) (KStream,KStream) โ†’ KStream โ˜‘
LeftJoin(windowed) (KStream,KStream) โ†’ KStream โ˜‘
OuterJoin(windowed) (KStream,KStream) โ†’ KStream โ˜‘
InnerJoin(windowed) (KTable,KTable) โ†’ KTable โ˜‘
LeftJoin(windowed) (KTable,KTable) โ†’ KTable โ˜‘
OuterJoin(windowed) (KTable,KTable) โ†’ KTable โ˜‘
InnerJoin(windowed) (KStream,KTable) โ†’ KStream โ˜‘
LeftJoin(windowed) (KStream,KTable) โ†’ KStream โ˜‘
InnerJoin(windowed) (KStream,GlobalKTable) โ†’ KStream โ˜‘
LeftJoin(windowed) (KStream,GlobalKTable) โ†’ KStream โ˜‘

Test topology driver

Must be used for testing your stream topology. Simulate a kafka cluster in memory. Usage:

static void Main(string[] args)
{
    var config = new StreamConfig<StringSerDes, StringSerDes>();
    config.ApplicationId = "test-test-driver-app";
    
    StreamBuilder builder = new StreamBuilder();

    builder.Stream<string, string>("test")
        .Filter((k, v) => v.Contains("test"))
        .To("test-output");

    Topology t = builder.Build();

    using (var driver = new TopologyTestDriver(t, config))
    {
        var inputTopic = driver.CreateInputTopic<string, string>("test");
        var outputTopic = driver.CreateOuputTopic<string, string>("test-output", TimeSpan.FromSeconds(5));
        inputTopic.PipeInput("test", "test-1234");
        var r = outputTopic.ReadKeyValue();
    }
}

TODO implementation

  • Statefull processors impl [ ]
  • Subtopology impl [ ]
  • Task restoring [ ]
  • Topology description [ ]
  • Global state store [ ]
  • Processor API [ ] + Refactor topology node processor builder [ ]
  • Repartition impl [ ]
  • Unit tests (TestTopologyDriver, ...) [ ]
  • Rocks DB state implementation [ ]
  • Optimizing Kafka Streams Topologies [ ]
  • Interactive Queries [ ]
  • Metrics [ ]

Some documentations for help during implementation : https://docs.confluent.io/current/streams/index.html

https://kafka.apache.org/20/documentation/streams/developer-guide/dsl-api.html#stateless-transformations

kafka-streams-dotnet's People

Contributors

lgouellec avatar

Watchers

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