Product, order and inventory services behind Spring Cloud Gateway (WebMVC), configuration from a Config Server, discovery with Eureka, a Resilience4j circuit breaker on order -> inventory and Brave tracing. Run as six plain jars; output/ holds real transcripts (config, registry, requests, trace propagation, circuit breaker, startup race and the load-balanced RestClient.Builder trap). Dockerfile and docker-compose.yml are included but were not run. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HhW8LD8r3EigoBaCGrQZx5
47 lines
1.7 KiB
Plaintext
47 lines
1.7 KiB
Plaintext
# Requests through the gateway (port 8080). The client only ever talks to 8080.
|
|
|
|
--- products ---
|
|
$ curl -X GET localhost:8080/api/products
|
|
HTTP 200
|
|
[{"id":1,"name":"Mechanical keyboard","price":89.90},{"id":2,"name":"USB-C dock","price":129.00},{"id":3,"name":"27-inch monitor","price":249.50}]
|
|
|
|
$ curl -X GET localhost:8080/api/products/2
|
|
HTTP 200
|
|
{"id":2,"name":"USB-C dock","price":129.00}
|
|
|
|
$ curl -X GET localhost:8080/api/products/99
|
|
HTTP 404
|
|
{"timestamp":"2026-10-21T17:07:49.313Z","status":404,"error":"Not Found","path":"/products/99"}
|
|
|
|
--- stock ---
|
|
$ curl -X GET localhost:8080/api/inventory/3
|
|
HTTP 200
|
|
{"productId":3,"quantity":3,"lowStock":true}
|
|
|
|
--- orders ---
|
|
$ curl -X POST localhost:8080/api/orders -d '{"productId":1,"quantity":2}'
|
|
HTTP 201
|
|
{"id":1,"productId":1,"productName":"Mechanical keyboard","quantity":2,"total":179.80,"currency":"EUR","status":"CONFIRMED"}
|
|
|
|
$ curl -X POST localhost:8080/api/orders -d '{"productId":3,"quantity":4}'
|
|
HTTP 409
|
|
{"timestamp":"2026-10-21T17:07:49.685Z","status":409,"error":"Conflict","path":"/orders"}
|
|
|
|
$ curl -X POST localhost:8080/api/orders -d '{"productId":2,"quantity":11}'
|
|
HTTP 400
|
|
{"timestamp":"2026-10-21T17:07:49.721Z","status":400,"error":"Bad Request","path":"/orders"}
|
|
|
|
$ curl -X POST localhost:8080/api/orders -d '{"productId":99,"quantity":1}'
|
|
HTTP 404
|
|
{"timestamp":"2026-10-21T17:07:49.763Z","status":404,"error":"Not Found","path":"/orders"}
|
|
|
|
$ curl -X GET localhost:8080/api/orders
|
|
HTTP 200
|
|
[{"id":1,"productId":1,"productName":"Mechanical keyboard","quantity":2,"total":179.80,"currency":"EUR","status":"CONFIRMED"}]
|
|
|
|
--- stock after the first order ---
|
|
$ curl -X GET localhost:8080/api/inventory/1
|
|
HTTP 200
|
|
{"productId":1,"quantity":18,"lowStock":false}
|
|
|