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.
✅ .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.
📌 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.
✅ .NET 9 SDK
✅ Docker (optional for containerization)
git clone https://github.com/yourusername/Notifications.Channel.git
cd Notifications.Channel
dotnet build
dotnet run --project src/Notifications.Channel
docker build -t notifications-channel .
docker run -p 8080:80 notifications-channel
🔹 Docker allows easy deployment in cloud environments or microservices architectures.
Method | Endpoint | Description |
---|---|---|
POST | /orders |
Creates a new order & triggers OrderCreatedNotification |
curl -X POST http://localhost:8080/orders
📢 When a new order is created, the API publishes an event that triggers multiple handlers asynchronously.
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.
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.
🔹 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.
Run tests to verify notification handling and performance:
dotnet test
📌 Use Postman or Swagger UI to:
✅ Create an order → /orders
✅ Check OpenTelemetry traces
✅ Verify async notification handling
✅ 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.
This project is licensed under the MIT License. See LICENSE for details.
For feedback, contributions, or questions:
📧 Email: mreshboboyev@gmail.com
💻 GitHub: MrEshboboyev
🚀 Build scalable, event-driven APIs with Notifications.Channel! Clone the repo & start now!