feat: data architecture transformation - event-driven decoupling with shared-events module - #9
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
- Create shared-events Maven module with common Axon Framework event definitions (CustomerCreatedEvent, CustomerUpdatedEvent, AccountCreatedEvent, AccountCreditedEvent, AccountDebitedEvent, AccountTransferredEvent, AccountActivatedEvent, AccountSuspendedEvent, AccountDeletedEvent) - Remove duplicated customer email field from Account entity in account-service - Refactor notification-service to consume Axon events instead of direct REST calls - Add CustomerEventHandler in account-service for CustomerUpdatedEvent - Create Flyway migration script for email column removal - Add Feign client in notification-service to look up customer email - Add AccountCustomerMapping entity for event-driven email lookup - Update all affected DTOs and API contracts - Add comprehensive unit tests (34 total tests passing) - Remove direct notification REST client coupling from account-service Co-Authored-By: Achal Channarasappa <achal.channarasappa@cognition.ai>
Co-Authored-By: Achal Channarasappa <achal.channarasappa@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Complete data architecture transformation to decouple cross-service data dependencies and introduce event-driven data synchronization across the banking microservices codebase.
Changes
1. New
shared-eventsMaven module (shared-events/)CustomerCreatedEvent,CustomerUpdatedEvent,AccountCreatedEvent,AccountCreditedEvent,AccountDebitedEvent,AccountTransferredEvent,AccountActivatedEvent,AccountSuspendedEvent,AccountDeletedEventAccountStatus,Currency,OperationType2. Removed duplicated customer email from account-service
emailfield fromAccountentity,AccountAggregate,CreateAccountCommand,AccountCreatedEventcustomerIdAccountEmailCustomerIdvalidation entity to only trackcustomerIdAccountCommandRestControllerto no longer pass email during account creation3. Refactored notification-service to consume Axon events
AccountEventNotificationHandlerthat subscribes to all account events via@EventHandlerCustomerRestClientFeign client to look up customer email from customer-serviceAccountCustomerMappingentity + repository for account-to-customer ID mapping (populated fromAccountCreatedEvent)AccountEventHandlerServiceNotificationService,NotificationServiceImpl,NotificationRestClient,NotificationRequestDTOfrom account-service4. CustomerEventHandler in account-service
CustomerEventHandlerlistens forCustomerUpdatedEventfrom shared-events5. Flyway migration
V1__remove_email_from_account.sqlremoves email column and unique constraint from account tablesbaseline-on-migrate=truefor existing databases6. Updated DTOs and API contracts
7. Comprehensive unit tests (34 tests passing)
AccountAggregateTest(8 tests) - removed email from all event/command constructorsAccountEventHandlerServiceTest(6 tests) - removed notification service mocksCustomerEventHandlerTest(2 tests) - tests for customer update projection syncAccountEventNotificationHandlerTest(8 tests) - tests for all event notification flows including customer lookup, mapping persistence, and error handlingReview & Testing Checklist for Human
V1__remove_email_from_account.sqlruns correctly against your database (theDROP COLUMN IF EXISTSsyntax is MySQL/MariaDB specific)AccountCustomerMappingin notification-service is correctly populated and used for non-creation events (credit, debit, suspend, etc.)axon.axonserver.enabledconfiguration is set correctly for your deployment environmentNotes
common.eventpackage) are kept for backward compatibility with the Axon event store serialization. The shared-events module provides cross-service event contracts.toShared()/fromShared()) for interoperability with shared-events enums.AccountCustomerMappingprojection - consider switching to a persistent store for production use.CustomerCreatedEvent/CustomerUpdatedEventin future iterations.Link to Devin session: https://app.devin.ai/sessions/c77d3461f3134ff08fec52d68f820311
Requested by: @achalc
Devin Review