Skip to main content

Release v1.32.4

Released on December 8, 2025

Executive Summary

Features

Billing & Finance

  • Introduced invoice-database-update-queue Dapr component for handling database updates via Azure Service Bus queues
  • Refactored invoice creation events to use InvoiceCreatedEvent instead of InvoiceEvent for improved event-driven architecture
  • Added InvoiceDatabaseUpdateQueue endpoint to process database updates and publish subsequent events

Infrastructure

  • Added new Dapr component configuration for invoice-database-update-queue with Azure Service Bus integration

Bug Fixes

Product Flows

  • Added error logging for product flow instance creation failures to improve diagnostics

Overview

This patch release enhances the invoice creation workflow by introducing a dedicated database update queue and refactoring event handling to use a more specific InvoiceCreatedEvent. The changes improve the separation of concerns in the event-driven architecture and provide better traceability for invoice-related database operations.

Features

Billing & Finance

  • Invoice Database Update Queue - Introduced a new Dapr component invoice-database-update-queue to handle invoice-related database updates via Azure Service Bus queues. This separates database update operations from the main invoice creation flow, improving reliability and enabling better retry and error handling patterns.

  • InvoiceCreatedEvent Refactoring - Created a new InvoiceCreatedEvent class to replace the generic InvoiceEvent in invoice creation scenarios. This provides:

    • More specific event typing for invoice creation operations
    • Better alignment with event-driven architecture patterns
    • Clearer intent in event handling code
    • Improved event payload structure
  • InvoiceDatabaseUpdateQueue Endpoint - Added a new Dapr subscription endpoint in EventsController to process database update events:

    • Processes events from the invoice-database-update-queue topic
    • Handles invoice database updates separately from creation
    • Publishes subsequent events after database updates complete
    • Endpoint priority set to 1 for appropriate processing order
  • Billing Constants Updates - Added new constants to BillingConstants:

    • InvoiceDatabaseUpdateQueueName = "invoice-database-update-queue"
    • InvoiceDatabaseUpdateTopicName = "invoice-database-update"
    • Centralizes queue and topic naming for consistency

Infrastructure

  • Dapr Component Configuration - Added new Dapr component configuration in containerAppEnvironment.bicep:
    • Component name: invoice-database-update-queue
    • Type: pubsub.azure.servicebus.queue
    • Configured with Azure Service Bus connection
    • Scoped to billing application
    • Includes proper metadata for queue naming

Bug Fixes

Product Flows

  • Product Flow Instance Creation Logging - Added error logging in SqlStorageProductFlowInstanceRepository when product flow instance creation fails. This improves diagnostics and troubleshooting capabilities by capturing failure information that was previously silent.

Technical Details

Event Flow Changes

Before:

// Generic InvoiceEvent used for all invoice operations
var invoiceEvent = new InvoiceEvent { InvoiceId = invoice.Id };
await publisher.PublishEventAsync("invoice-creation", invoiceEvent);

After:

// Specific InvoiceCreatedEvent for creation operations
var invoiceCreatedEvent = new InvoiceCreatedEvent { InvoiceId = invoice.Id };
await publisher.PublishEventAsync("invoice-database-update", invoiceCreatedEvent);

New Event Processing Flow

  1. Invoice is created in Sage/external system
  2. InvoiceCreatedEvent published to invoice-database-update topic
  3. InvoiceDatabaseUpdateQueue endpoint processes the event
  4. Database is updated with invoice information
  5. Subsequent events (email, notifications) are triggered after database update

Infrastructure Configuration

{
name: 'invoice-database-update-queue'
type: 'pubsub.azure.servicebus.queue'
metadata: [
{
name: 'connectionString'
value: serviceBusConnectionString
}
{
name: 'queueName'
value: 'invoice-database-update-queue'
}
]
scopes: ['billing']
}

Files Changed

Added Files

  • libs/Billing/Billing.Finance/InvoiceCreatedEvent.cs - New event class for invoice creation

Modified Files

  • infrastructure/bicep/containerAppEnvironment.bicep - Added invoice-database-update-queue component
  • libs/Billing/Billing.Models/BillingConstants.cs - Added queue and topic constants
  • libs/Finance/Finance.Integration/SageService.cs - Updated to use InvoiceCreatedEvent
  • services/Billing/Billing/Controllers/EventsController.cs - Added InvoiceDatabaseUpdateQueue endpoint
  • libs/ProductManagement/ProductFlows.Data/Repositories/SqlStorageProductFlowInstanceRepository.cs - Added error logging

Impact

Billing Services

  • Invoice creation flow now has better separation of concerns
  • Database updates are processed through a dedicated queue
  • Improved reliability for invoice-related database operations
  • Better error handling and retry capabilities

Event-Driven Architecture

  • More specific event types improve code clarity
  • Better alignment with domain-driven design principles
  • Easier to track invoice creation lifecycle

Monitoring & Diagnostics

  • Product flow creation failures now logged for better troubleshooting
  • Invoice database update operations can be monitored separately

Migration Notes

For Developers

  • Use InvoiceCreatedEvent instead of InvoiceEvent for invoice creation scenarios
  • Reference BillingConstants.InvoiceDatabaseUpdateQueueName and BillingConstants.InvoiceDatabaseUpdateTopicName for queue/topic names
  • New Dapr subscription endpoint handles invoice database updates

For Infrastructure

  • New Dapr component invoice-database-update-queue requires deployment
  • Azure Service Bus queue invoice-database-update-queue will be automatically created
  • No changes required to existing infrastructure beyond bicep deployment

Known Issues

None

Contributors

Thanks to the development team for implementing these invoice processing improvements!

  • Tiaan Du Toit - Invoice event refactoring and queue implementation
  • Armand van der Walt - Product flow logging enhancement