Extract Consumer Service into standalone microservice (strangler fig pattern)#185
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Open
Extract Consumer Service into standalone microservice (strangler fig pattern)#185devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Conversation
- Create ftgo-consumer-service-standalone module with Spring Boot app
- Move Consumer entity and ConsumerRepository from ftgo-domain to both
standalone and original consumer-service modules
- Add REST API endpoints: POST /consumers, GET /consumers/{id},
POST /consumers/{id}/validate-order
- Create ConsumerServiceProxy interface and HTTP client implementation
in ftgo-order-service to replace direct ConsumerService dependency
- Update OrderService and OrderConfiguration to use proxy
- Remove compile project(':ftgo-consumer-service') from order-service
- Remove consumer-service dependency from ftgo-application
- Add Consumer Service to docker-compose.yml with own MySQL database
- Add Flyway migration for consumers table
- Update end-to-end tests for separate consumer service port
- Add Dockerfile for standalone consumer service
- Update build-and-restart script to include consumer service
Co-Authored-By: benc <Benc@windsurf.com>
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
Extracts the Consumer Service from the FTGO monolith into an independent Spring Boot microservice, following the same strangler fig pattern used for the Restaurant Service extraction. This breaks the direct compile dependency between
OrderServiceandConsumerService.Key changes:
ftgo-consumer-service-standalonemodule: Standalone Spring Boot app (port 8082) with its ownConsumerentity,ConsumerRepository,ConsumerService, REST controller (POST /consumers,GET /consumers/{id},POST /consumers/{id}/validate-order), Flyway migration, Dockerfile, and dedicated MySQL database (ftgo_consumer_service).ConsumerServiceJava import inOrderServicewith aConsumerServiceProxyinterface +ConsumerServiceProxyHttpClientimplementation usingRestTemplate. Thecompile project(":ftgo-consumer-service")dependency is removed fromftgo-order-service/build.gradle.ftgo-applicationno longer importsConsumerServiceConfiguration; consumer service URL is injected viaconsumer.service.urlproperty.docker-compose.ymlwith its own container, MySQL schema created inmysql/schema.sql, build script updated.ftgo-consumer-servicemodule updated: Gets its own localConsumer/ConsumerRepositorycopies (previously inftgo-domain) and switches fromDomainConfigurationtoCommonConfigurationsince those entities were removed fromftgo-domain.Review & Testing Checklist for Human
ConsumerServiceProxyHttpClientsends aMoneyobject inside aMap<String, Object>viaRestTemplate. The standalone consumer service'sValidateOrderRequestmust deserialize this correctly. Verify that theMoneyModule(custom Jackson serializer) is registered in the standalone consumer service's Spring context — the broad@SpringBootApplication(scanBasePackages = "net.chrisrichardson.ftgo")may or may not pick it up. If not, the/validate-orderendpoint will fail at runtime with a deserialization error.FtgoApplicationTestviability: The test removedConsumerServiceConfigurationfrom its@ImportbutOrderConfigurationnow creates aConsumerServiceProxyHttpClientbean that needs a running consumer service (or a mock). This test will likely fail in its current form — it may need a test profile that provides a mockConsumerServiceProxyor an embedded consumer service.docker-compose up, create a consumer viaPOST :8082/consumers, then create an order viaPOST :8081/ordersand verify the order creation flow calls the consumer service over HTTP successfully. Check container logs for connection errors.ValidateOrderRequestclass completeness: Verify it has a no-arg constructor and proper getters/setters for Jackson deserialization (the full class was not visible in the truncated diff).@SpringBootApplication(scanBasePackages = "net.chrisrichardson.ftgo")scans all shared modules. Confirm no conflicting bean definitions or unwanted auto-configurations are picked up.Recommended test plan: Run
docker-compose up --build, wait for health checks to pass, then exercise the full order creation flow (create consumer → create restaurant → create order) and verify the monolith successfully calls the consumer service over HTTP for validation.Notes
ftgo-end-to-end-tests-common, which has a pre-existing dependency resolution failure (eventuate-util-test:0.1.0.RELEASEnot found) unrelated to this PR.ftgo-applicationindocker-compose.ymlwas updated fromcom.mysql.jdbc.Drivertocom.mysql.cj.jdbc.Driverto match the MySQL 8 connector already in use.Consumer.javaandConsumerRepository.javanow exist in bothftgo-consumer-serviceandftgo-consumer-service-standalone— this duplication is intentional during the strangler fig transition. The old module remains in the Gradle build but is no longer imported byftgo-application.Link to Devin session: https://app.devin.ai/sessions/cbb2c366f0d74cbfb1fe30170cef4647
Requested by: @bcmake