Skip to content

Repository files navigation

FlinkDotNet

FlinkDotNet is a .NET framework that enables developers to write Apache Flink 2.1 streaming jobs in C# and submit them to production Flink clusters. This repo also provides a comprehensive distributed messaging architecture that enables developers to build stream processing using Apache Flink 2.1, Apache Kafka, Temporal workflows, and Microsoft Aspire orchestration - all accessible through a native .NET SDK.

BuildLocalTesting Integration TestsDay01 Integration TestsObservability Integration Tests

Quality Gate StatusCoverageSecurity RatingMaintainability RatingReliability RatingDuplicated Lines (%)VulnerabilitiesBugsCode SmellsTechnical DebtLines of Code

.NET 9.0Apache Flink 2.1Apache KafkaTemporalMicrosoft Aspire

What is Kafka and Flink? Why Do We Need Them?

The Problems You'll Face as Your Application Grows

StageWhat WorksProblems You'll HitWhy Simple Solutions Break
Starting OutSingle server + databaseEverything runs on one machineWorks great for small apps!
Growing FastNeed to handle more usersServer crashes under heavy loadOne machine can't handle thousands of users at once
Data gets lost when server restartsNo backup - if server dies, everything is gone
Slow response timesProcessing requests one by one is too slow
Going BigNeed multiple serversHow do servers talk to each other?Direct connections become a tangled mess
Messages get lost between serversNetwork failures mean data disappears
Can't track long-running processesIf a process takes hours, how do you monitor it?
Need to process data in real-timeBatch processing is too slow for live data
Enterprise ScaleMillions of users globallyCoordinating across data centersHundreds of servers need to work together seamlessly
Handling 1 million+ connections per secondNeed smart routing and load balancing
Data must survive server failuresRedundancy and durability become critical
Complex retry logic neededFailures happen - need automatic recovery

The Solutions: Kafka, Flink, and Temporal

FlinkDotNet brings billion-scale architecture to .NET developers - combining these three technologies to handle routing billions of messages per second across distributed systems, processing them in real-time with global context awareness, and coordinating millions of complex workflows simultaneously.

What is FlinkDotNet?

FlinkDotNet lets you write Apache Flink 2.1 streaming jobs in C# and submit them to Flink clusters. No Java required. A complete distributed message-oriented architecture for building enterprise stream processing applications in .NET, it combines:

  • Apache Flink 2.1 - distributed stream processing engine with state management.
  • Apache Kafka - Distributed message streaming/queue
  • Temporal - Durable workflow orchestration/Durable execution solution.
  • Microsoft Aspire - Local development containerised orchestration.
  • FlinkDotNet SDK - Native .NET API for writing Flink jobs in C#
varenv=Flink.GetExecutionEnvironment();varstream=env.FromKafka(topic:"orders",bootstrapServers:"localhost:9092",groupId:"order-consumer-group").Filter(order =>order.Amount>100).Map(order =>order.ToUpperCase()).SinkToKafka("processed-orders","localhost:9092");awaitenv.ExecuteAsync("order-processor");

Distributed Architecture with Aspire Orchestration

.NET Aspire orchestrates the complete distributed message-oriented architecture locally, providing production-parity development environments.

Full Architecture Stack

Stream Processing Layer:

  • Apache Flink 2.1 - JobManager, TaskManager, and SQL Gateway for real-time stream processing
  • FlinkDotNet SDK - Native .NET DataStream API with fluent C# DSL
  • Job Gateway - ASP.NET Core service for job submission and management

Messaging & Orchestration Layer:

  • Apache Kafka - KRaft-mode message broker with JMX metrics export
  • Temporal - Durable workflow orchestration with PostgreSQL backend

Observability Stack (LearningCourse mode):

  • Prometheus - Metrics collection from Flink, Kafka, and custom applications
  • Grafana - Visualization dashboards for performance monitoring
  • JMX Exporters - Metrics bridge for Java components

With one command, Aspire starts all containers, configures service discovery, and provides a unified dashboard - enabling you to develop and test complete distributed streaming applications locally.

Component Roles in High-Throughput Processing

When processing millions of messages per second, each component plays a critical role:

Apache Kafka - Message ingestion and buffering

  • Handles message ingestion at scale (millions of messages/second)
  • Provides durable message storage with partitioning for parallel consumption
  • Acts as buffer between producers and stream processors
  • Enables replay and reprocessing of historical data

Apache Flink 2.1 - Distributed stream processing engine

  • Processes messages in parallel across multiple TaskManager instances
  • Provides stateful computations with exactly-once processing guarantees
  • Scales horizontally by adding more TaskManager slots
  • Handles backpressure to prevent system overload

FlinkDotNet SDK - .NET development interface

  • Enables writing stream processing logic in C# with type safety
  • Compiles to Flink's native execution model
  • Provides fluent API for common streaming patterns (map, filter, window, join)
  • Eliminates need for Java expertise while maintaining full Flink performance

Temporal - Durable workflow orchestration

  • Manages long-running workflows across distributed job submissions
  • Provides guaranteed execution with automatic retries and compensation
  • Maintains workflow state even during infrastructure failures
  • Coordinates complex multi-step processing pipelines

Microsoft Aspire - Local development orchestration

  • Simulates production environment locally with container orchestration
  • Manages service discovery between Kafka, Flink, Temporal, and custom services
  • Provides unified dashboard for monitoring all components
  • Enables rapid iteration and testing before production deployment

Together, these components form a production-grade streaming architecture capable of processing high-volume event streams with reliability and fault tolerance.

Try It Out

# Prerequisites: .NET 9.0 SDK, Docker Desktop (or Podman)# 1. Clone and run LocalTesting
git clone https://github.com/devstress/FlinkDotnet.git
cd FlinkDotnet/LocalTesting
dotnet run --project LocalTesting.FlinkSqlAppHost
# 2. Aspire Dashboard opens at http://localhost:15888# 3. Navigate to LearningCourse folder and follow the instructions there
# Or run integration tests to validate everything works
dotnet test LocalTesting.IntegrationTests

LocalTesting includes integration tests that validate the complete pipeline: Kafka → Flink → Processing → Output.

Apache Flink Versions Coverage

FlinkDotNet provides 100% feature parity with Apache Flink 1.0-2.1, implementing all major features across every version release.

Version-by-Version Coverage

Flink VersionRelease DateCoverageKey Features Implemented
1.0-1.92016-2019100%DataStream API, Windows, State Management, CEP, Kafka Integration
1.10Feb 2020100%Table API, SQL Gateway, Catalog API
1.11Jul 2020100%DDL Support, Change Data Capture
1.12Dec 2020100%Unified Source API/FLIP-27, SQL Connectors
1.13May 2021100%SQL Functions, Window TVF
1.14Nov 2021100%SQL Client, Batch SQL
1.15-1.182022-2023100%Table Store/Apache Paimon, Advanced Table Features
1.19Mar 2024100%Performance Improvements, Checkpoint Optimizations
1.20Oct 2024100%Unified Sink v2 (WI6), Materialized Tables
2.0Mar 2025100%Disaggregated State Management, Unified Batch/Stream, API Overhaul
2.1Jul 2025100%AI/ML Integration, VARIANT Type, PTFs, Performance & Format

Learn FlinkDotNet

LearningCourse provides a 15-day hands-on course covering:

  • Day 01: Kafka-Flink Data Pipeline
  • Day 02: Flink 2.1 Fundamentals - Complete Apache Flink 1.0-2.1 Version Coverage
  • Day 03-15: Advanced topics (AI integration, backpressure, observability, workflows, stress testing, and more)

Each day includes working examples and integration tests you can run locally.

Documentation

Installation

NuGet Package

dotnet add package FlinkDotNet

Docker Image

docker pull devstress/flinkdotnet:latest
docker run -p 8086:8086 \
-e FLINK_CLUSTER_HOST=your-flink-host \
-e FLINK_CLUSTER_PORT=8081 \
devstress/flinkdotnet:latest

Standalone Executables

Download from GitHub Releases - includes Windows and Linux packages.

Requirements

  • .NET 9.0 SDK - For development
  • Docker Desktop or Podman - For local testing with Aspire
  • Apache Flink 2.1 cluster - For production deployments

Community & Support

License

MIT License - see LICENSE for details.


Get Started: Try the LocalTesting environment or explore the 15-Day Learning Course.

About

FlinkDotnet lets you build and run Apache Flink streaming jobs using a fluent C# API. Powered by Microsoft Aspire, it provides one-click distributed orchestration for Kafka, Flink, Temporal, Prometheus, Grafana, and FlinkDotnet itself; making end-to-end distributed stream processing seamless for .NET developers.

Topics

Resources

Contributing

Stars

20 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages