BusProxy - Project Overview
Solution Structure
Solution: TELS.WebServices.BusProxy.sln
| Project |
Type |
Framework |
Description |
| TELS.WebServices.BusProxy |
ASP.NET Core Web API |
.NET 8.0 |
REST API for message publishing |
| TELS.BusProxy.Client |
Class Library |
.NET Standard 2.0 |
Client NuGet package for consuming services |
| TELS.BusProxy.Client.SqlFallback |
Class Library |
.NET Standard 2.0 |
SQL Server fallback handler |
| TELS.BusProxy.Client.S3Fallback |
Class Library |
.NET Standard 2.0 |
AWS S3 fallback handler |
| TELS.WebServices.BusProxy.DbUp |
Console App |
.NET 8.0 |
Database migrations |
| TELS.WebServices.BusProxy.Test |
Unit Tests |
.NET 8.0 |
API tests |
Purpose
BusProxy is a centralized message publishing infrastructure that decouples services from specific message bus technologies. It provides:
- Technology-Agnostic Publishing: Services call HTTP API, BusProxy handles bus-specific details
- Resilient Delivery: Automatic fallback to SQL Server or AWS S3 if primary bus unavailable
- Delayed Delivery: Schedule messages for future delivery
- Multi-cast: Publish to multiple bus technologies simultaneously
- Background Processing: Retry failed messages every 60 seconds
Architecture
Components
Consumer Service
↓ (HTTP POST)
BusProxy API
↓ (primary)
RabbitMQ / SQS / MSMQ
↓ (fallback on failure)
SQL Server Queue ←→ bus-proxy-queue-processor
OR
AWS S3 Bucket
Fallback Strategies
| Environment |
Primary |
Fallback |
| Production/Sandbox |
RabbitMQ |
AWS S3 |
| Local/Integration |
RabbitMQ |
SQL Server |
Technology Stack
| Category |
Technology |
| Runtime |
.NET 8.0 (API), .NET Standard 2.0 (Client) |
| Web Framework |
ASP.NET Core 8.0 |
| Message Bus |
MassTransit 8.5.7 + RabbitMQ |
| Database |
SQL Server (TELS database) |
| Cloud Storage |
AWS S3 (AWSSDK.S3 4.0.15.1) |
| Migration |
DbUp |
| Logging |
NLog 6.0.7 |
| Monitoring |
New Relic APM 10.47.2 |
| Auth |
JWT Bearer |
| API Docs |
Swagger/Swashbuckle 9.0.3 |
| Containerization |
Docker (multi-arch: ARM64 preferred, AMD64 fallback) |
Key Features
1. Resilient Message Publishing
- Primary Delivery: Direct to RabbitMQ/SQS/MSMQ via MassTransit
- Fallback: Persist to SQL table or S3 bucket on failure
- Retry: Background processor attempts delivery every 60 seconds
- Guaranteed Delivery: Messages not lost even if bus unavailable
2. Client Libraries (NuGet Packages)
- TELS.BusProxy.Client - Core client
- TELS.BusProxy.Client.SqlFallback - SQL Server fallback
- TELS.BusProxy.Client.S3Fallback - AWS S3 fallback
- Usage: Services add NuGet package, call
IPublisher.PublishMessage()
3. Delayed Delivery
- Schedule messages for future delivery
- Configurable delay times
- Uses MassTransit scheduling under the hood
4. Authorization
- JWT Bearer token required
- Restricted user list (configured in database)
- Service accounts only (not for end users)
API Surface
Endpoints
- POST /publish - Publish message to bus
- POST /publish/delayed - Schedule message for delayed delivery
- GET /health - Health check
- GET /swagger - API documentation
Authentication
- JWT Bearer token in Authorization header
- Token must be from authorized service account
- User list managed in SQL Server table
Database
SQL Server (TELS Database)
Tables:
- Message queue table (fallback storage)
- Authorized users table
- Processing state tracking
Deployment
Docker Containers
- Multi-architecture support (ARM64 preferred, AMD64 fallback)
- Runs on AWS ECS
- High availability (multiple instances)
Configuration
| Setting |
Purpose |
| RabbitMQ Connection |
Primary message bus |
| SQL Connection |
Fallback storage + auth |
| AWS S3 |
Fallback storage (prod) |
| JWT Signing Key |
Token validation |
| Retry Interval |
Background processor frequency (60s) |
Client Usage Example
// Add NuGet packages:
// TELS.BusProxy.Client
// TELS.BusProxy.Client.SqlFallback (or S3Fallback)
// Register in DI
services.AddSingleton<IDeliveryHandler, WebServiceHandler>();
services.AddSingleton<IDeliveryHandler, SqlServerFallbackHandler>(); // or S3FallbackHandler
services.AddSingleton<IPublisher, Publisher>();
// Publish message
await publisher.PublishMessage(new MyEvent
{
Data = "value"
});
bus-proxy-queue-processor: Worker service that processes messages from SQL fallback queue
Key Files
| File |
Purpose |
/src/TELS.WebServices.BusProxy/Controllers/PublishController.cs |
API endpoints |
/src/TELS.BusProxy.Client/Publisher.cs |
Client library |
/src/TELS.BusProxy.Client.SqlFallback/SqlServerFallbackHandler.cs |
SQL fallback |
/src/TELS.BusProxy.Client.S3Fallback/S3FallbackHandler.cs |
S3 fallback |
/README.md |
Setup and usage documentation |
Notes
- Critical Infrastructure: Used by Tasks, CloudAPI, TicketExceptions, and many other services
- Decoupling: Services don't need RabbitMQ/MassTransit dependencies - just HTTP client
- Resilience: Fallback ensures no message loss even during bus outages
- NuGet Package: Client library published to internal NuGet feed
- Version Compatibility: .NET Standard 2.0 client supports .NET Framework and .NET Core/5+