| Service | Pulls | Size | Version |
|---|---|---|---|
| API | |||
| User API | |||
| Web (Portal) | |||
| Function-Invalidator |
MessageBus is a lightweight, Azure-integrated 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 to an Azure Service Bus queue, and processing those events asynchronously using independent Azure Function worker.
The worker invokes the Web API's cache invalidation endpoint, which removes stale keys from the distributed cache (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.
An event-publishing pattern using Azure Service Bus Queue supporting:
-
Asynchronous message delivery
-
Queue-based message processing
-
JSON serialization
-
Decoupled event publishing and consumption
An Azure Function worker triggered by Azure Service Bus messages that:
-
Receives cache invalidation events from Azure Service Bus
-
Invokes the Web API's cache invalidation endpoint
-
Removes stale keys from Dragonfly/Redis through the Web API
-
Optionally logs the invalidation action
The worker runs independently and never blocks the API.
A standard flow:
-
API completes database update
-
API publishes a cache-related event
-
Azure Service Bus delivers the message to a queue.
-
Azure Function consumes the message.
-
Function invokes the Web API's cache invalidation endpoint.
-
Web API removes the relevant keys from Dragonfly/Redis.
MessageHubAzure uses GitHub Actions to automate deployments to Azure Container Apps.
The deployment workflow supports selective project builds and deployments by comparing changes against the previous Git tag.
-
Change Detection: Identifies modified projects by comparing the current release with the previous Git tag.
-
Selective Builds: Builds only the affected applications (Web App and User API).
-
Automated Deployment with Manual Triggering: Deploys the selected applications to Azure Container Apps when manually initiated through GitHub Actions.
This avoids unnecessary builds and deployments when a new version contains changes limited to specific applications.
# Clone the repository
git clone https://github.com/hasanjaved-developer/message-hub-azure.git
cd message-hub-azure
# Start the observability stack
docker compose -f docker-compose.yml up -dThis project is licensed under the MIT License.

