Skip to content

Feature/029 message request management#36

Merged
ovation22 merged 9 commits intomainfrom
feature/029-message-request-management
Apr 8, 2026
Merged

Feature/029 message request management#36
ovation22 merged 9 commits intomainfrom
feature/029-message-request-management

Conversation

@ovation22
Copy link
Copy Markdown
Owner

No description provided.

ovation22 and others added 9 commits February 4, 2026 15:03
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.
@ovation22 ovation22 merged commit 67c47ca into main Apr 8, 2026
@ovation22 ovation22 deleted the feature/029-message-request-management branch April 8, 2026 19:09
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