feat: Implement ProcessWorker for message consumption#142
Merged
Conversation
- Create ProcessContext class with process metadata - Add helper methods for metadata management - Provide cancellation token for cooperative cancellation - Document purpose and usage in XML comments Related to #99
- Add Metadata dictionary to ProcessMessage - Update FromProcess to include metadata - Maintain JSON property naming for serialization Related to #99
- Create ProcessWorker as BackgroundService - Integrate IMessageConsumer for message consumption - Implement process lifecycle management - Add comprehensive error handling with ACK/NACK logic - Support graceful shutdown - Add detailed logging for operations - Handle deserialiation errors separately Related to #99
- Process domain entity does not have Metadata property - Metadata is only part of the message, not persisted in Process - Initialize Metadata to null in FromProcess Fixes compilation error CS1061 Related to #99
- Use AcknowledgeAsync instead of AckAsync - Use RejectAsync instead of NackAsync - RejectAsync accepts bool parameter for requeue - Methods are Func properties that need to be invoked Fixes compilation errors CS1061 Related to #99
- Replace IProcessRepository and IPolicyProvider with IProcessService - Update all test cases to use correct constructor signature - Fix parameter names in ArgumentNullException tests - Update StartConsumingAsync type to ProcessMessage Related to #99
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements the background worker for consuming and processing messages from RabbitMQ queue, completing the asynchronous process execution pipeline.
Changes
Core Domain
Server Components
BackgroundServicefor long-running message consumptionIMessageConsumerusing callback patternMessageContext.AcknowledgeAsync()andRejectAsync()Testing
Configuration
ProcessWorkeras hosted serviceArchitecture Notes
IProcessServicefacade instead of direct repository access for better separation of concernsMessageContextwith delegate-based ACK/NACKRabbitMqConsumerimplementationProcessContextcreated but not yet integrated (reserved for future handler enhancement)Message Flow
Testing
Related Issues
Closes #99
Checklist
Breaking Changes
None
Migration Notes
No migration required. The worker is automatically registered and will start consuming messages when the Server application starts.