Skip to content

is a .NET-based notification service using the Outbox Pattern for reliable, asynchronous message processing and event handling.

Notifications You must be signed in to change notification settings

AlexGreatDev/OutboxWebApp

Repository files navigation

ReportOutBox - Notification Service with Outbox Pattern

Table of Contents

  1. Overview
  2. Technologies
  3. Setup Instructions
  4. How to Run the Services
  5. Testing
  6. Additional Notes

Overview

ReportOutBox is a notification service that processes notifications in the background using the Outbox Pattern. The system stores events in the outbox table and processes them asynchronously to send notifications (e.g., email or system alerts). The service is built to be resilient, ensuring that messages are not lost even in the case of failures.

Technologies

This project is built using the following technologies:

  • .NET 6 (or later)
  • Background Services for handling message dispatching
  • In-Memory Database for data storage (you can switch to SQL Server if needed)
  • ASP.NET Core for the API layer

Setup Instructions

Prerequisites

Make sure the following software is installed on your machine:

  • .NET 6 (or later)

1. Clone the Repository

Clone the repository to your local machine:

git clone https://github.com/AlexGreatDev/OutboxWebApp.git
cd OutboxWebApp

2. Install Dependencies

Install the necessary packages:

dotnet restore

3. Configure Database (Optional)

The project is configured to use an In-Memory Database by default, which is perfect for development and testing. If you want to use SQL Server, you can modify the Startup.cs or Program.cs to configure a SQL Server connection string.

Example:

builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer("Your_Connection_String_Here"));

4. Run the Application

Run the application using the following command:

dotnet run

This will start both the API and the background service.

How to Run the Services

Background Service

The Notification Background Service runs automatically when the application starts. This service listens for new notifications and processes them asynchronously.

Notification Controller

The Notification Controller exposes an API to manage notifications. You can interact with it to send notifications and retrieve status.

Example of endpoint:

  • POST /api/notifications/send – Triggers a notification event.

Testing

You can run the tests using the following command:

dotnet test

Tests are used to ensure that the notification service works correctly, and the background service processes messages as expected.

Additional Notes

  • Outbox Pattern: This service follows the Outbox Pattern to ensure reliable messaging. When a notification is triggered, it's stored in the outbox table and processed by the background service. This ensures that no messages are lost, even if there's a failure in the system.

  • Background Processing: The system uses background services to handle long-running tasks asynchronously without blocking the main application.

  • Data Storage: For simplicity, an In-Memory Database is used for this project. If needed, you can switch to a persistent SQL Server database by adjusting the configuration in the code.

About

is a .NET-based notification service using the Outbox Pattern for reliable, asynchronous message processing and event handling.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages