Build a small user management system that uses background jobs to process uploaded documents, send notifications, run nightly cleanup, and handle retries — without blocking the public API.
-
Allowed Language: C#
-
Recommended Versions:
.NET 6+ -
OS: Any (Windows / Linux / macOS)
-
You may use any background job / task scheduling library, such as:
- Hangfire (recommended)
- Quartz.NET
- BackgroundService + custom scheduling logic
-
Basic familiarity with:
- RESTful APIs
- Background job processing
- Retry policies
- File operations
You are implementing a User Management System where users register via an API and upload a document file (any type such as image, Word, etc.). The system must behave as follows:
-
Accept user registration with an uploaded document.
-
Immediately return a fast response without waiting for heavy tasks.
-
Handle background jobs:
- Send a welcome message immediately after registration.
- Process the uploaded document after a 30-second delay, converting it to PDF (simulation allowed).
- After successful processing, send a follow-up completion message.
- Run a nightly cleanup at 00:00 to remove unused or incomplete files.
-
Apply an automatic retry policy for every job:
- Maximum 2 retries
- Retry #1 after 5 minutes
- Retry #2 after 10 minutes (after the previous attempt)
-
Background tasks must never block the API.
Your job is to design and implement this workflow cleanly and maintainably.
-
The
POST /api/users/registerAPI:- Must store user data + file metadata
- Must enqueue background jobs
- Must return immediately (
201 Created)
-
The 30-second delay must be implemented with delayed job scheduling.
-
The nightly cleanup must be implemented as a recurring job (cron:
0 0 * * *). -
PDF conversion may be simulated (writing/copying dummy PDF file).
-
Retry policy must be handled by the job library.
-
Code must be clean, modular, and readable.
-
Endpoint:
POST /api/users/register -
Input:
- name, email
- document file
-
Behavior:
- Save user + file metadata
- Enqueue immediate job → Send Welcome Message
- Enqueue delayed job (30s) → Process Document
- Return success response quickly
- Runs immediately
- Logs/Notifies: "Welcome !"
- Must not block API
- Loads file metadata
- Converts to PDF (simulation allowed)
- Updates document status
- Enqueues completion message job
- Triggered after PDF creation
- Message: "Your document has been processed and is now available."
- Runs daily at midnight
- Removes unused, orphan, stale files
- Applies to all jobs
- Failure → retry 5 min → retry 10 min
- After exhaustion → log and persist
POST /api/users/register HTTP/1.1
Content-Type: multipart/form-data
...Response:
{
"userId": "a1f9c570-0f3b-4d7d-9c35-0a0c12345678",
"status": "Registered",
"message": "User registered successfully."
}T0 : Registration → HTTP 201
T0 + 0s : Welcome message
T0 +30s : Document processing
T0 +40s : PDF ready → completion message
00:00 : Nightly cleanup
git clone https://github.com/<org>/<repo>.git
cd <repo>- Configure Hangfire storage (SQL Server / Redis)
- Setup file storage paths
dotnet build
dotnet rundotnet test- Fork repository
- Create branch:
git checkout -b solution/<username>- Place solution under:
solutions/C#/<username>/
├── source
└── README.md
- Create PR titled:
[Solution] User Document Background Processing - <username>
| Criteria | Weight |
|---|---|
| Correctness | 40% |
| Code Quality | 25% |
| Retry Logic | 10% |
| API & Observability | 10% |
| Documentation | 5% |
| Early Submission | 5% |
- Start:
2025-11-30 - PR Submission Deadline:
2025-12-07
- .NET / Backend Community Group
- Open an Issue in the repository for questions.