https://github.com/mreshboboyev/notifications-channel
Notifications.Channel is an asynchronous notification system built with .NET 9, MediatR, and OpenTelemetry. It uses channel-based publishers for efficient, non-blocking event processing, ensuring scalability, observability, and real-time notifications in distributed applications.
https://github.com/mreshboboyev/notifications-channel
asyncronous-messaging background-processing channels cloud-native docker event-driven-architecture event-handling logging mediatr microservices notifications observability open-telemetry pub-sub tracing
Last synced: 3 months ago
JSON representation
Notifications.Channel is an asynchronous notification system built with .NET 9, MediatR, and OpenTelemetry. It uses channel-based publishers for efficient, non-blocking event processing, ensuring scalability, observability, and real-time notifications in distributed applications.
- Host: GitHub
- URL: https://github.com/mreshboboyev/notifications-channel
- Owner: MrEshboboyev
- Created: 2025-02-25T13:16:27.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2025-02-25T14:02:41.000Z (3 months ago)
- Last Synced: 2025-02-25T14:41:44.851Z (3 months ago)
- Topics: asyncronous-messaging, background-processing, channels, cloud-native, docker, event-driven-architecture, event-handling, logging, mediatr, microservices, notifications, observability, open-telemetry, pub-sub, tracing
- Language: C#
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Notifications.Channel โ Scalable Asynchronous Notifications in .NET 9 ๐




## ๐ฏ Overview
**Notifications.Channel** is a **high-performance, asynchronous notification system** built with **.NET 9**, **MediatR**, and **OpenTelemetry**. This solution provides **event-driven messaging** using a **custom channel-based publisher**, ensuring **scalability, reliability, and observability** for real-time notifications.
> **Why Use Notifications.Channel?**
> - ๐ **Asynchronous & Non-Blocking** โ Uses **channels for efficient notification handling**.
> - ๐ก **Event-Driven Design** โ Implements **MediatR for pub/sub messaging**.
> - ๐ **Built-in Observability** โ Integrated with **OpenTelemetry** for tracing.
> - ๐ **Docker-Ready & Scalable** โ Deployable in **containerized environments**.---
## ๐ Features
โ **.NET 9 Web API** โ Built with the latest **ASP.NET Core framework**.
โ **MediatR Integration** โ Implements **publish-subscribe (pub/sub) messaging**.
โ **Channel-Based Notifications** โ Uses **custom channel publishers** for async handling.
โ **Multiple Notification Handlers** โ Supports **parallel processing**.
โ **OpenTelemetry Tracing** โ Provides **real-time observability**.
โ **Docker Support** โ Easily deploy with **Docker containers**.---
## ๐๏ธ Architecture & Project Structure
๐ **src/Notifications.Channel/Program.cs** โ Configures **MediatR, OpenTelemetry**, and API setup.
๐ **src/Notifications.Channel/ChannelPublisher.cs** โ Implements the **custom channel-based publisher**.
๐ **src/Notifications.Channel/OrderCreatedNotification.cs** โ Defines the **notification event**.
๐ **src/Notifications.Channel/NotificationHandlers/** โ Contains **async notification handlers**.---
## ๐ Getting Started
### **๐ Prerequisites**
โ [.NET 9 SDK](https://dotnet.microsoft.com/download/dotnet/9.0)
โ [Docker](https://www.docker.com/) (optional for containerization)### **Step 1: Clone the Repository**
```bash
git clone https://github.com/yourusername/Notifications.Channel.git
cd Notifications.Channel
```### **Step 2: Build & Run the Application**
```bash
dotnet build
dotnet run --project src/Notifications.Channel
```---
## ๐ณ Running with Docker
### **Step 1: Build Docker Image**
```bash
docker build -t notifications-channel .
```### **Step 2: Run Container**
```bash
docker run -p 8080:80 notifications-channel
```> ๐น **Docker allows easy deployment** in **cloud environments** or **microservices architectures**.
---
## ๐ API Endpoints
| Method | Endpoint | Description |
|--------|-----------|-------------|
| **POST** | `/orders` | Creates a new order & triggers **OrderCreatedNotification** |### **Example Request (cURL)**
```bash
curl -X POST http://localhost:8080/orders
```> ๐ข **When a new order is created**, the API **publishes an event** that triggers **multiple handlers** asynchronously.
---
## ๐ OpenTelemetry Integration
This project is **pre-configured with OpenTelemetry** for **end-to-end tracing**, providing **real-time monitoring** of notifications.
๐น **Features**:
โ **ASP.NET Core Instrumentation** โ Captures **request-response tracing**.
โ **OTLP Exporter** โ Sends telemetry data to **external observability platforms**.
โ **Real-Time Monitoring** โ View **end-to-end tracing** of notifications.---
## ๐จ MediatR & Asynchronous Notifications
### **How Notifications Work**
1๏ธโฃ **Client sends a POST request to `/orders`**.
2๏ธโฃ **MediatR publishes an `OrderCreatedNotification` event**.
3๏ธโฃ **ChannelPublisher asynchronously processes notifications**.
4๏ธโฃ **Multiple handlers consume the notification in parallel**.### **Notification Handlers**
๐น **OrderCreatedHandler** โ Logs **order creation event**.
๐น **SlowOrderCreatedHandler** โ Simulates a **delayed event handler**.
๐น **VerySlowOrderCreatedHandler** โ Simulates a **long-running task**.> โก **Handlers process events independently** without blocking the main request.
---
## ๐งช Testing
### **Unit Tests**
Run tests to verify **notification handling and performance**:
```bash
dotnet test
```### **Manual API Testing**
๐ **Use Postman or Swagger UI** to:
โ **Create an order** โ `/orders`
โ **Check OpenTelemetry traces**
โ **Verify async notification handling**---
## ๐ฏ Why Use This Project?
โ **High-Performance Asynchronous Notifications** โ Reduces **blocking operations**.
โ **Scalable & Fault-Tolerant** โ Uses **channels & MediatR** for parallel execution.
โ **Full Observability with OpenTelemetry** โ Provides **tracing & monitoring**.
โ **Production-Ready & Docker-Deployable** โ Easily **scales in microservices**.---
## ๐ License
This project is licensed under the **MIT License**. See [LICENSE](LICENSE) for details.
---
## ๐ Contact
For feedback, contributions, or questions:
๐ง **Email**: [email protected]
๐ป **GitHub**: [MrEshboboyev](https://github.com/MrEshboboyev)---
๐ **Build scalable, event-driven APIs with Notifications.Channel!** Clone the repo & start now!