refactor: migrate worker functionality to outbox use case#11
Merged
Conversation
Replace the worker package with a proper use case implementation in the outbox domain, following Clean Architecture principles and improving extensibility. Changes: - Create internal/outbox/usecase/outbox_usecase.go with OutboxUseCase implementation that handles event processing with configurable retry logic and transaction management - Introduce EventProcessor interface for extensible event handling, allowing custom processors to be plugged in - Add DefaultEventProcessor as the default implementation for basic event processing with logging - Migrate all tests from worker package to outbox usecase with full coverage (78.8%) - Update DI container (internal/app/di.go) to initialize and provide OutboxUseCase instead of EventWorker - Update cmd/app/main.go runWorker function to use OutboxUseCase - Remove internal/worker package entirely Documentation updates: - Update README.md project structure to show complete outbox module with domain, usecase, and repository layers - Enhance README.md transactional outbox pattern section to explain use case-based approach and extensibility via EventProcessor - Rewrite docs/architecture.md transactional outbox section with detailed explanations of the new architecture, including code examples for custom event processors - Update docs/getting-started.md to clarify that worker command runs the outbox event processor - Update docs/development.md to reflect new terminology Benefits: - Better architecture: Follows Clean Architecture with proper separation of concerns - Improved extensibility: EventProcessor interface allows custom event handling without modifying core logic - Enhanced maintainability: Outbox functionality now properly organized within the outbox domain - Consistent with existing patterns: Matches the structure of other domains (user, etc.) - Same functionality: Worker command continues to work identically
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.
Replace the worker package with a proper use case implementation in the outbox domain, following Clean Architecture principles and improving extensibility.
Changes:
Documentation updates:
Benefits: