Skip to content

HasanJaved-Developer/MessageHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ MessageHub

Build codecov Docker Compose CI License Release Zero Windows Dependencies GHCR api GHCR userapi GHCR web GHCR invalidator

🐳 Docker Hub Images

Service Pulls Size Version
API Pulls Size Version
User API Pulls Size Version
Web (Portal) Pulls Size Version
Invalidator Pulls Size Version

MessageBus is a lightweight RabbitMQ-powered message pipeline focused on event-driven cache invalidation in .NET applications.

It provides a clean pattern for publishing events from APIs after completing database updates, and processing those events asynchronously using independent worker services that connect to Dragonfly/Redis.

This approach keeps APIs fast and responsive while ensuring cache consistency across services.

The worker’s responsibility is only to remove stale keys. Any pre-warm logic (such as regenerating and repopulating cache values) remains inside the web application and will execute naturally on the next access after invalidation.

A single role update can affect hundreds of users β€” so distributed cache invalidation is essential for consistent authorization.


πŸ”§ Features

βœ”οΈ Event Bus Abstraction

A minimal IEventBus interface with a RabbitMQ implementation supporting:

durable exchanges

routing keys

persistent messages

JSON serialization

βœ”οΈ Cache Invalidation Worker

A background worker that listens to specific events and:

receives an event from RabbitMQ

invalidates related keys in Redis/Dragonfly

(optionally) logs the invalidation action

The worker runs independently and never blocks the API.

βœ”οΈ Clean Publish β†’ Process Pattern

A standard flow:

API completes database update

API publishes a cache-related event

RabbitMQ routes the event to a queue

Cache worker consumes the event

Worker removes the relevant keys in Redis


πŸ‡ RabbitMQ Management Dashboard

Open RabbitMQ Management Dashboard:

http://localhost:15672

(default credentials: rabbit / rabbit)


🧱 Architecture Snapshot

Integration Portal Architecture
View Mermaid source


πŸ“Έ Screenshots


πŸ” Permission Change Trigger (UI Action That Publishes the Event)

Permissions

πŸ“¨ RabbitMQ β€” Permission Invalidation Message Received

Permissions

🧩 Worker Process β€” Handling PermissionInvalidation Messages

Cache Invalidation Diagram
View Mermaid source


πŸ” Quick Start (Preview)

# Clone the repository
git clone https://github.com/hasanjaved-developer/message-hub.git
cd message-hub

# Start the observability stack
docker compose -f docker-compose.yml up -d

πŸ“œ License

This project is licensed under the MIT License.