How hxh1234/projext-test works
Project type and purpose
• This is a standalone backend microservice (Spring Boot / Maven) whose job is to process seller-pricing requests, schedule invoice generation, persist data, and emit invoice events. It does not include a UI—it exposes REST endpoints and listens to Kafka topics.
File structure
• Top level: configuration files (pom.xml, Dockerfile, docker-compose.yml, Makefile), CI/CD workflows under .github/workflows, and docs.
• src/main/java: a single Spring Boot application (“Application.java”), subdivided into packages:
• configuration (Spring beans, Kafka, Mongo, caching, scheduling)
• controller (REST API layer with exception handlers)
• domain (JPA-style entities / Mongo documents, enums)
• dto (data transfer objects for external APIs: FIT, MailBrew, Salesforce, Seller API)
• kafka (consumer & producer classes)
• mapper (DTO ↔ domain mapping)
• model (internal models used within handlers and services)
• repository (Spring Data Mongo repositories)
• rest/resources (client wrappers for external HTTP services)
• schedule (scheduled jobs for DAC7, pricing, notifications)
• service (business logic, orchestrations, file upload/download, BigQuery integration, caching)
• service/handler (strategy handlers for different pricing flows)
• src/main/resources: Spring profiles, logging, SQL for initial data load
• Tests mirror the same packages plus dedicated test DB dockerfile and init scripts.
README
• The README is empty, so we infer architecture purely from code structure and existing docs in docs/pricing-request.
• Kafka cluster (topics: seller-pricing-requests, subscribed pricing updates, seller-invoice-events)
• REST API layer (Controller package serving inbound HTTP requests)
• Business layer (Service & Handler packages orchestrating flows)
• Data persistence (MongoDB for domain data, plus BigQuery for analytics)
• Scheduling subsystem (cron jobs for DAC7 notif., pricing calculations)
• External services:
– Seller API (v3) for seller info
– Salesforce ACL API
– FIT API for invoice requests
– MailBrew API for emailing invoices
– Google Cloud Storage / BigQuery for file I/O
b. Relationships & interactions
• REST Controller → Service → Repository → MongoDB
• Kafka Consumer → Service/Handler → Repository → emit Kafka Producer events
• Scheduled Jobs → Service layer → external services and repository
• Service calls out via REST clients (rest/resources) to FIT / Salesforce / MailBrew / Seller API / GCP
• Optional cache (Caffeine) between Service and Repository/External APIs
c. Architectural patterns & principles
• Layered architecture: Controller → Service → Repository
• Hexagonal/Ports & Adapters: rest/resources and kafka packages are adapters for external I/O
• Strategy pattern: Service/handler package defines interchangeable pricing request handlers
• Event-driven: Kafka for decoupling inbound requests and outbound invoice events
• Scheduled tasks: Spring @Scheduled for timed jobs
d. Key technologies & frameworks
• Spring Boot (web, data-mongodb, kafka, scheduling)
• Spring Data MongoDB
• Apache Kafka
• Caffeine cache
• Google Cloud BigQuery and Storage (via GCP libraries)
• Lombok, Avro serializers in tests
• Docker & Docker-compose for local dev (Mongo, Kafka, schema registry)
→ inbound HTTP POST → controller → service → repo → Mongo
→ Kafka topic → consumer → handler → producer → Kafka topic
→ scheduled trigger → service → external API
→ service → BigQuery / GCS
– Blue: core microservice packages (Controller / Service / Repository)
– Green: message broker (Kafka)
– Orange: external HTTP services
– Yellow: data stores (MongoDB, BigQuery)
– Purple: scheduled tasks
Details to capture
• Every adapter/port (Kafka, REST, database)
• The strategy handlers for different pricing flows
• Cache layer and retry configuration
• Docker-compose local environment