Skip to content

feat: add Service-Oriented Architecture pattern (#2937) - #3600

Open
ylcn91 wants to merge 3 commits into
iluwatar:masterfrom
ylcn91:feat/service-oriented-architecture
Open

ylcn91 wants to merge 3 commits into
iluwatar:masterfrom
ylcn91:feat/service-oriented-architecture

Conversation

@ylcn91

@ylcn91 ylcn91 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the Service-Oriented Architecture (SOA) pattern as a new service-oriented-architecture module, implemented in plain Java without frameworks so the architectural mechanism stays visible.

  • Key components:
    • Service: the contract every service exposes (name() and handle(ServiceRequest)); services are stateless.
    • ServiceRequest / ServiceResponse: coarse-grained, self-describing messages that form the interoperability boundary (flat payload, uniform response envelope).
    • ServiceRegistry: discovery by name on a ConcurrentHashMap, rejects duplicate registrations.
    • ServiceBus: routes messages to the registered service, applies cross-cutting concerns (tracing, timing) in one place and translates provider failures into error responses, so consumers only ever talk to the bus.
    • CustomerService, InventoryService, PaymentService: reusable atomic services.
    • OrderService: composite service that orchestrates the three atomic services through the bus to place an order.
    • App: bootstraps registry and bus, registers the services, places an order that succeeds, one that is rejected for stock, and addresses an unregistered service. Logging traces every message.
    • README.md: intent, real-world example, diagram, code walkthrough, applicability, real-world uses (ESBs, SOAP/WSDL), trade-offs, related patterns including how SOA differs from microservices. PlantUML class diagram under etc/.
  • Tests: 24 JUnit 5 tests covering registry, bus routing and error translation, each atomic service, and order orchestration (success, unknown customer, out of stock, payment declined), plus AppTest.
  • Module registered in the parent pom.xml. ./mvnw clean verify -pl service-oriented-architecture passes locally on JDK 21 and inside an eclipse-temurin:21 container.

Fixes #2937

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

PR Summary

Adds a framework-free SOA module implementing key architectural roles: Service, ServiceBus, ServiceRegistry and AccessPolicy, plus atomic services (Customer, Inventory, Payment) and a composite OrderService. Includes App bootstrap, tests, and diagrams/documentation. Also updates the root pom.xml to register the new module and provides a README with usage and trade-offs.

Changes

File Summary
pom.xml - Added new module reference for service-oriented-architecture in the parent pom to enable building the SOA module.
service-oriented-architecture/README.md - Documentation describing the SOA pattern, its intent, real-world applicability, and how the example demonstrates the pattern including the bus, registry, and orchestration.
service-oriented-architecture/etc/service-oriented-architecture.urm.png - Added a PNG diagram (class diagram) illustrating the SOA structure.
service-oriented-architecture/etc/service-oriented-architecture.urm.puml - Added PlantUML source diagram describing the SOA class diagram and relationships.
service-oriented-architecture/pom.xml - Introduces the SOA Maven module with dependencies and build configuration (including main class).
service-oriented-architecture/src/main/java/com/iluwatar/soa/AccessPolicy.java - Implements AccessPolicy to control access to protected services using a set of valid credentials and a set of protected services.
service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java - Bootstraps the registry and bus, registers services, and demonstrates end-to-end SOA usage via sample orders.
service-oriented-architecture/src/main/java/com/iluwatar/soa/Customer.java - Defines the Customer value type used by CustomerService.
service-oriented-architecture/src/main/java/com/iluwatar/soa/CustomerService.java - Provides an in-memory CustomerService with getCustomer operation.
service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java - Implements InventoryService with stock management: checkStock, reserve, release (including non-positive quantity validation).
service-oriented-architecture/src/main/java/com/ iluwatar/soa/InventoryService.java - Implements InventoryService with stock management: checkStock, reserve, release (including non-positive quantity validation).
service-oriented-architecture/src/main/java/com/iluwatar/soa/OrderService.java - Composite OrderService orchestrating customer, inventory and payment via the bus; includes compensation on failure.
service-oriented-architecture/src/main/java/com/iluwatar/soa/PaymentService.java - PaymentService implementing charge with credit-limit enforcement and payment reference generation.
service-oriented-architecture/src/main/java/com/iluwatar/soa/Service.java - Defines the Service contract interface for providers.
service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java - Core bus routing requests, applying access policy, logging, and translating provider failures into error responses.
service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRegistry.java - In-memory registry for service discovery with registration, lookup, and listing capabilities (with duplicate check).
service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRequest.java - Coarse-grained request envelope carrying target service, operation, payload and optional credential.
service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceResponse.java - Uniform response envelope with success flag, body and message; includes static ok/error creators.
service-oriented-architecture/src/test/java/com/iluwatar/soa/AccessPolicyTest.java - Tests AccessPolicy behavior for permitAll, protected services and credentials.
service-oriented-architecture/src/test/java/com/iluwatar/soa/AppTest.java - Tests App bootstrap to ensure the SOA demo runs without errors.
service-oriented-architecture/src/test/java/com/iluwatar/soa/CustomerServiceTest.java - Tests CustomerService operations: known customer, unknown customer, and unknown operation.
service-oriented-architecture/src/test/java/com/iluwatar/soa/InventoryServiceTest.java - Tests InventoryService behavior: availability, reserve/release, and error cases.
service-oriented-architecture/src/test/java/com/iluwatar/soa/OrderServiceTest.java - Tests order placement, stock reservation, payment handling, and compensation paths.
service-oriented-architecture/src/test/java/com/iluwatar/soa/PaymentServiceTest.java - Tests PaymentService charging within limit, exceeding limit, non-positive amounts and unknown operation.
service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceBusTest.java - Tests routing, unknown services, exception translation, and security checks on the bus.
service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceRegistryTest.java - Tests service lookup, empty results for unknown services, and duplicate registration handling.

autogenerated by presubmit.ai

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • 993cea1: feat: add Service-Oriented Architecture pattern (#2937)
Files Processed (22)
  • pom.xml (1 hunk)
  • service-oriented-architecture/README.md (1 hunk)
  • service-oriented-architecture/etc/service-oriented-architecture.urm.puml (1 hunk)
  • service-oriented-architecture/pom.xml (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Customer.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/CustomerService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/OrderService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/PaymentService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Service.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRegistry.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRequest.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceResponse.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AppTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/CustomerServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/InventoryServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/OrderServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/PaymentServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceBusTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceRegistryTest.java (1 hunk)
Actionable Comments (4)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [61-61]

    best_practice: "Fix incorrect logger usage in App.java"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java [57-57]

    best_practice: "Logger usage mismatch with Lombok @slf4j in ServiceBus"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRegistry.java [56-56]

    best_practice: "Logger usage mismatch in ServiceRegistry"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java [93-101]

    possible bug: "Malformed string concatenation in reserve() error path"

Skipped Comments (0)

@ylcn91

ylcn91 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Note on the automated review comments: LOGGER is the Lombok logger field name configured for this repository in lombok.config (lombok.log.fieldName = LOGGER), the same name every other module uses, so the code compiles as is. The multi-line string concatenation in InventoryService is a single expression and is covered by InventoryServiceTest. Local ./mvnw clean verify -pl service-oriented-architecture passes on JDK 21, also inside an eclipse-temurin:21 container.

@codecov

codecov Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.22%. Comparing base (4cabb20) to head (0b71863).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3600      +/-   ##
============================================
+ Coverage     84.06%   84.22%   +0.15%     
- Complexity     4353     4424      +71     
============================================
  Files          1133     1144      +11     
  Lines         15400    15599     +199     
  Branches        739      755      +16     
============================================
+ Hits          12946    13138     +192     
- Misses         2158     2163       +5     
- Partials        296      298       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ylcn91
ylcn91 force-pushed the feat/service-oriented-architecture branch from 993cea1 to 84e5c17 Compare September 3, 2026 09:43
@ylcn91

ylcn91 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Updated the branch to cover point 8 (Security) of the issue guidelines: the bus now enforces an AccessPolicy as a cross-cutting concern (protected services require a valid credential, denial returns an error response and services stay free of security code). OrderService forwards the caller's credential downstream and no longer references provider classes, only service names and message contracts. Added AccessPolicyTest and extra bus/order cases (32 tests, 99% instruction coverage), README section, sample output and class diagram updated. ./mvnw clean verify -pl service-oriented-architecture passes locally on JDK 21 and in an eclipse-temurin:21 container.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • 84e5c17: feat: add Service-Oriented Architecture pattern (#2937)
Files Processed (24)
  • pom.xml (1 hunk)
  • service-oriented-architecture/README.md (1 hunk)
  • service-oriented-architecture/etc/service-oriented-architecture.urm.puml (1 hunk)
  • service-oriented-architecture/pom.xml (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/AccessPolicy.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Customer.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/CustomerService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/OrderService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/PaymentService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Service.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRegistry.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRequest.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceResponse.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AccessPolicyTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AppTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/CustomerServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/InventoryServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/OrderServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/PaymentServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceBusTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceRegistryTest.java (1 hunk)
Actionable Comments (1)
  • service-oriented-architecture/pom.xml [46-50]

    enhancement: "Missing JUnit Jupiter API test dependency"

Skipped Comments (0)

Comment thread service-oriented-architecture/pom.xml
@ylcn91
ylcn91 force-pushed the feat/service-oriented-architecture branch from 84e5c17 to 453f532 Compare September 3, 2026 09:52
@ylcn91

ylcn91 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up on the Codecov note: added OrderServiceTest cases with a stub inventory service (reservation fails after a successful stock check; stock check itself fails) and a ServiceBusTest case for a wrong non-null credential. 35 tests, the only uncovered line left is the implicit App constructor. Tests only. ./mvnw clean verify -pl service-oriented-architecture passes locally on JDK 21 and in an eclipse-temurin:21 container.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • 453f532: feat: add Service-Oriented Architecture pattern (#2937)
Files Processed (24)
  • pom.xml (1 hunk)
  • service-oriented-architecture/README.md (1 hunk)
  • service-oriented-architecture/etc/service-oriented-architecture.urm.puml (1 hunk)
  • service-oriented-architecture/pom.xml (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/AccessPolicy.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Customer.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/CustomerService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/OrderService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/PaymentService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Service.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRegistry.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRequest.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceResponse.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AccessPolicyTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AppTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/CustomerServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/InventoryServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/OrderServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/PaymentServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceBusTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceRegistryTest.java (1 hunk)
Actionable Comments (1)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java [92-100]

    possible bug: "Fix potential string concatenation bug in error message"

Skipped Comments (8)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [67-67]

    best_practice: "Logger usage mismatch with Lombok @slf4j"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [76-76]

    best_practice: "Replace LOGGER with log when using @slf4j"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [78-78]

    best_practice: "Consistent logging with Lombok"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [88-88]

    best_practice: "Consistent logging with Lombok"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [98-98]

    best_practice: "Consistent logging with Lombok"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [102-102]

    best_practice: "Consistent logging with Lombok"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [106-106]

    best_practice: "Consistent logging with Lombok"

  • service-oriented-architecture/pom.xml [36-50]

    test: "Add junit-jupiter-api as test dependency"

@ylcn91
ylcn91 force-pushed the feat/service-oriented-architecture branch from 453f532 to bf16d6e Compare September 3, 2026 11:32
@ylcn91

ylcn91 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Coverage follow-up: added AppTest.shouldBeInstantiable for the implicit App constructor, the last uncovered line. JaCoCo now reports 100% instruction, branch and line coverage. Verified locally on JDK 21 and in an eclipse-temurin:21 container.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM!

Review Summary

Commits Considered (1)
  • bf16d6e: feat: add Service-Oriented Architecture pattern (#2937)
Files Processed (24)
  • pom.xml (1 hunk)
  • service-oriented-architecture/README.md (1 hunk)
  • service-oriented-architecture/etc/service-oriented-architecture.urm.puml (1 hunk)
  • service-oriented-architecture/pom.xml (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/AccessPolicy.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Customer.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/CustomerService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/OrderService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/PaymentService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Service.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRegistry.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRequest.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceResponse.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AccessPolicyTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AppTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/CustomerServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/InventoryServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/OrderServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/PaymentServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceBusTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceRegistryTest.java (1 hunk)
Actionable Comments (0)
Skipped Comments (5)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java [67-70]

    best_practice: "Use the correct Lombok logger field"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java [66-92]

    best_practice: "Logger usage should use the Lombok-provided 'log' field"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRegistry.java [51-57]

    best_practice: "Logger usage should use the Lombok-provided 'log' field"

  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java [93-98]

    readability: "Clarify error message construction"

  • service-oriented-architecture/pom.xml [36-39]

    best_practice: "Add junit-jupiter-api test dependency"

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 Pull request needs attention.

Review Summary

Commits Considered (4)
  • 12e9aa7: fix: surface the inventory error when the stock check fails

OrderService reported every failed stock check as insufficient stock, which hid the real reason, for example a non-positive quantity. It now forwards the inventory message and only reports insufficient stock when the check itself succeeded.

  • 23462b6: docs: embed the rendered class diagram in the service-oriented-architecture README

Render etc/service-oriented-architecture.urm.puml to PNG and embed it in the detailed explanation section, matching the other modules, instead of the inline mermaid block.

  • a88f9d8: chore: tidy service javadoc and use the customer id in confirmations

Reword the App class javadoc so it describes the services the same way as the Service contract and the README: they keep no per-conversation state instead of being called stateless.

Note in OrderService.placeOrder that the checkStock call is there to illustrate service composition and not as a guard, since reserve re-checks the stock atomically.

Carry the customer id into OrderConfirmation so the confirmation identifies the customer it belongs to, and drop the unused email component from the Customer record. Update the tests, the URM diagram and the sample output in the README accordingly.

  • 83eb3c8: fix: reserve stock before charging and validate order quantity

  • OrderService now reserves stock before charging and releases the reservation when the charge fails, so a rejected order never leaves the customer charged.

  • InventoryService gains a release operation and rejects a non-positive quantity in checkStock, reserve and release.

  • ServiceBus applies the access policy before the registry lookup, so a denied caller cannot probe which services exist.

  • Corrected the statelessness and interoperability claims in the javadoc and the README.

  • Replaced the class diagram link with an inline mermaid diagram, refreshed the sample output and kept the puml in sync.

Files Processed (15)
  • service-oriented-architecture/README.md (1 hunk)
  • service-oriented-architecture/etc/service-oriented-architecture.urm.png (0 hunks)
  • service-oriented-architecture/etc/service-oriented-architecture.urm.puml (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Customer.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/CustomerService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/OrderService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Service.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRequest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/CustomerServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/InventoryServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/OrderServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceBusTest.java (1 hunk)
Actionable Comments (1)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java [102-109]

    bug: "Fix string concatenation in error message"

Skipped Comments (0)

@ylcn91
ylcn91 force-pushed the feat/service-oriented-architecture branch from 12e9aa7 to a569f16 Compare September 7, 2026 08:04
The order flow is now reserve, charge, release on failure. Inventory rejects non-positive quantities and its errors are surfaced, the access policy runs before the registry lookup, the statelessness and interoperability wording is corrected, and confirmations carry the customer id. The class diagram is a rendered PNG.
@ylcn91
ylcn91 force-pushed the feat/service-oriented-architecture branch from a569f16 to cd7ff04 Compare September 7, 2026 09:09

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM!

Review Summary

Commits Considered (2)
  • cd7ff04: fix: reserve stock before charging and validate order quantity

The order flow is now reserve, charge, release on failure. Inventory rejects non-positive quantities and its errors are surfaced, the access policy runs before the registry lookup, the statelessness and interoperability wording is corrected, and confirmations carry the customer id. The class diagram is a rendered PNG.

  • bf16d6e: feat: add Service-Oriented Architecture pattern (#2937)
Files Processed (25)
  • pom.xml (1 hunk)
  • service-oriented-architecture/README.md (1 hunk)
  • service-oriented-architecture/etc/service-oriented-architecture.urm.png (0 hunks)
  • service-oriented-architecture/etc/service-oriented-architecture.urm.puml (1 hunk)
  • service-oriented-architecture/pom.xml (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/AccessPolicy.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/App.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Customer.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/CustomerService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/InventoryService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/OrderService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/PaymentService.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/Service.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceBus.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRegistry.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceRequest.java (1 hunk)
  • service-oriented-architecture/src/main/java/com/iluwatar/soa/ServiceResponse.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AccessPolicyTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/AppTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/CustomerServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/InventoryServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/OrderServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/PaymentServiceTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceBusTest.java (1 hunk)
  • service-oriented-architecture/src/test/java/com/iluwatar/soa/ServiceRegistryTest.java (1 hunk)
Actionable Comments (0)
Skipped Comments (0)

* @param args command line arguments, not used
*/
public static void main(String[] args) {
LOGGER.info("Bootstrapping the service registry and the service bus");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a class annotated with @slf4j, Lombok provides a 'log' field, not 'LOGGER'. The code currently uses LOGGER.info(...), which will not compile. Replace with log.info(...) and align all other logging calls in this file accordingly.

request.operation(),
request.credential() == null ? "anonymous" : "credentialed");
return ServiceResponse.error("Access denied to " + request.service());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging is done with LOGGER, but the class uses @slf4j. Replace LOGGER.* with log.* to align with Lombok's generated logger.

request.operation(),
response.success(),
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
return response;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further in this file, all remaining LOGGER usages should be replaced with log to maintain consistency with @slf4j. Example: log.info("-> {}.{} payload={}", ...)

@ylcn91

ylcn91 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Hi @iluwatar, I've resolved the merge conflicts in pom.xml and the CI checks are passing now. Is there anything you'd like me to change or improve in this PR before it can be reviewed? Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Service-Oriented Architecture pattern

1 participant