A robust, containerized .NET 9 Web API designed to handle asynchronous background processing. This project demonstrates how to decouple heavy processing tasks from the main user interface to ensure high availability and system reliability.
- Asynchronous Processing: Uses a Background Service (Worker) to process jobs independently of the API response.
- Self-Healing Infrastructure: Configured with Docker
restart: alwaysand automated EF Core migrations to ensure the system recovers from failures automatically. - Database Persistence: Integrated with PostgreSQL to track job statuses (Pending, Processing, Completed).
- Fault Tolerance: Designed to handle database connection delays during container startup.
- Framework: .NET 9 (Web API)
- Database: PostgreSQL 18
- ORM: Entity Framework Core
- Containerization: Docker & Docker Compose
- Documentation: Swagger UI
To get the entire system running locally, you only need one command:
docker-compose up --build
Once started:
API/Swagger: http://localhost:5010/swagger
Database: localhost:5433
## 📈 Real-World Use Case (e.g., Safaricom M-PESA)
This architecture is built for scenarios like:
* ** Transactional SMS: Sending confirmations after a transaction without making the user wait for the network.
Bulk Billing: Generating thousands of invoices at midnight via the background worker.
Third-Party Integrations: Managing retries when external APIs (like banking gateways) are temporarily down.
## 📂 Project Structure
TaskOrchestrator.Api: The entry point for client requests.
TaskOrchestrator.Infrastructure: Contains the Database Context, Repositories, and the Background Processing Service.
TaskOrchestrator.Core: Domain models and business logic.