Skip to content

Feature 029: Message Request Management & Monitoring#35

Merged
ovation22 merged 7 commits intomainfrom
feature/029-message-request-management
Feb 6, 2026
Merged

Feature 029: Message Request Management & Monitoring#35
ovation22 merged 7 commits intomainfrom
feature/029-message-request-management

Conversation

@ovation22
Copy link
Copy Markdown
Owner

Summary

Implement comprehensive admin dashboard widget and management page for viewing, monitoring, and replaying asynchronous message requests across all four microservices (Breeding, Feeding, Racing, Training).

Changes

Phase 1: API Completion

  • Added replay endpoints for Feeding service (individual and batch)
  • Added batch replay endpoint for Training service
  • All four services now have consistent replay functionality

Phase 2: Schema Consistency

  • Moved FeedingRequest entity to fed schema for consistency with other services
  • Added indexes on Status, CreatedDate, and HorseId columns for query optimization

Phase 3: Unified Message Service

  • Created MessageService for cross-service request aggregation
  • Implemented MessagesController with unified query and replay endpoints
  • Added shared DTOs (MessageRequestSummary, RequestServiceType, RequestStatus)
  • Optimized queries with database-level pagination using Ardalis.Specification

Phase 4: Dashboard Widget

  • Added MessageRequestWidget to Home page showing real-time queue health
  • Displays pending/failed counts for all four services
  • Auto-refreshes every 30 seconds
  • Click-through navigation to management page

Phase 5: Management Page

  • Created /messages page with comprehensive request management UI
  • Summary cards showing counts per service with bulk replay actions
  • Filterable data grid (by status and service type)
  • Individual and bulk replay functionality with confirmation dialogs
  • Added navigation link in main menu

Phase 6: Performance & UX Improvements

  • Implemented database-level pagination to eliminate timeout issues
  • Added dynamic buffer sizing for cross-table aggregation
  • Fixed pagination to properly display multiple pages
  • Added ID column to request grid
  • Implemented skeleton loading states and error handling

API Endpoints

New unified endpoints:

  • GET /api/messages/summary - Get aggregated status counts
  • GET /api/messages - Get paginated requests with filtering
  • POST /api/messages/{serviceType}/{id}/replay - Replay individual request
  • POST /api/messages/{serviceType}/replay-all - Batch replay by service

Added service-specific endpoints:

  • POST /api/feedings/requests/{id}/replay
  • POST /api/feedings/requests/replay-all
  • POST /api/trainings/requests/replay-all

Technical Details

  • Uses Ardalis.Specification pattern for optimized database queries
  • FluentUI Blazor components for consistent UI/UX
  • Sequential database operations to avoid EF Core concurrency issues
  • Database-level filtering and pagination for performance
  • Comprehensive error handling with toast notifications

Testing

  • All four services tested for replay functionality
  • Pagination tested with multiple pages of data
  • Filter combinations tested (status + service type)
  • Error states verified (API failures, not found scenarios)

Related

Phase 1: API Completion

Added missing replay functionality to align all async services:
- FeedingService: Individual replay (POST /feedings/requests/{id}/replay)
- FeedingService: Batch replay (POST /feedings/requests/replay-all)
- TrainingService: Batch replay (POST /trainings/requests/replay-all)

Service implementation follows BreedingService pattern:
- Returns false/404 for completed requests to prevent re-processing
- Resets Failed status to Pending before republishing
- Batch operations use SemaphoreSlim for parallel processing
- Returns count of published messages

Tests:
- 12 new passing tests covering service and controller behavior
- Uses reflection for anonymous object assertions
- All 781 tests passing

Documentation:
- Feature spec: 029-message-request-management.md
- Implementation plan with 6 TDD phases
Phase 2: Schema Migration

Updated FeedingRequestConfiguration to align with other request entities:
- Added "fed" schema (matching brd, rac, trn pattern)
- Configured Status property with byte conversion and default value
- Added FailureReason max length (1024 characters)
- Made required properties explicit (HorseId, FeedingId, OwnerId, etc.)
- Added indexes on Status, CreatedDate, and HorseId for query performance

All four async services now have consistent schema organization:
- BreedingRequest: brd schema
- RaceRequest: rac schema
- TrainingRequest: trn schema
- FeedingRequest: fed schema

Tests: All 781 tests passing
Phase 3: MessageService & Controller (Aggregation Layer)

Created unified API for viewing and managing async request messages across
all services (Breeding, Feeding, Racing, Training).

New components:
- RequestServiceType enum: Unified service type identifier
- RequestStatus enum: Unified status mapping across all services
- MessageRequestSummary DTO: Individual request summary with service context
- MessageRequestsSummaryResult DTO: Aggregated counts per service
- IMessageService: Interface for cross-service querying
- MessageService: Implementation with GetSummaryAsync and GetAllRequestsAsync
- MessagesController: REST endpoints for summary, listing, and replay delegation

API endpoints:
- GET /api/messages/summary: Status counts for all services
- GET /api/messages: Paginated list with status/service type filters
- POST /api/messages/{serviceType}/{id}/replay: Individual replay delegation
- POST /api/messages/{serviceType}/replay-all: Batch replay delegation

Design decisions:
- Status filtering uses enum byte casting for consistency
- Service type filtering skips irrelevant tables for performance
- Training service replay wrapped to return bool (consistency)
- Richardson Maturity Model Level 2 (HTTP verbs, proper status codes)
- 202 Accepted for async operations

Tests:
- 11 new passing tests (4 service + 7 controller)
- All 792 tests passing

DI registration:
- MessageService registered in Program.cs
Implemented real-time message queue monitoring widget on the home page:
- Created MessagesApiClient for API communication
- Built MessageRequestWidget with auto-refresh (30s intervals)
- Added pending/failed counts for all 4 services (Breeding, Feeding, Racing, Training)
- Implemented skeleton loading states and error handling with retry
- Integrated widget into Home page grid layout
- Implemented database-level pagination using specifications with dynamic buffer sizing
- Fixed pagination to properly skip records when navigating pages
- Added Messages.razor management page with grid, filters, and pagination
- Extended MessagesApiClient with GetAllRequests, ReplayRequest, and ReplayAll methods
- Used RefreshItems callback pattern for automatic pagination updates
- Refactor MessageService to use database-level pagination with Ardalis.Specification
- Implement dynamic buffer sizing to handle cross-table aggregation efficiently
- Fix Messages page pagination using RefreshItems callback pattern
- Add ID column to message request grid
- Add Message Queues navigation link with mail icon
- Update Home dashboard with message queue summary cards

Performance improvements eliminate timeout issues by avoiding loading entire tables into memory.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2026

Test Results

746 tests  +23   746 ✅ +23   6s ⏱️ -1s
  1 suites ± 0     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 94da286. ± Comparison against base commit b322bde.

♻️ This comment has been updated with latest results.

@ovation22 ovation22 merged commit 9ba9148 into main Feb 6, 2026
2 checks passed
@ovation22 ovation22 deleted the feature/029-message-request-management branch February 6, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant