2.7 KiB
2.7 KiB
go-order-manager — agents map
Thin, small service: persists the side of order events that the cart-actor
publishes. Reads from RabbitMQ; writes orders to disk. Almost all of the
business logic lives in go-cart-actor; this is the durable, simple shadow.
Where to start
main.go— wiring (HTTP server + RabbitMQ client + persistence).order.go— theOrderstruct + related types.order_client.go—RabbitTransportClient(the AMQP consumer) +UpdateHandlerinterface.capture.go— payment/fulfilment capture payload.README.md— intent.deployment/order-manager.yaml— k8s deployment (usesAMQP_URL).
Architecture
- Single binary, single role: consumer of the order event stream
(
order-queueon a RabbitMQ exchange). - Durable record: persists orders received via the queue; the HTTP surface is mostly read/admin.
- No opinions on cart logic — that's
go-cart-actor's domain. This service is the keeper of the resulting artefacts.
Important files by area
| Area | File |
|---|---|
| Wiring | main.go |
| Domain model | order.go |
| Capture payload | capture.go |
| AMQP consumer | order_client.go |
| Deploy | deployment/order-manager.yaml |
Cross-project seams
go-cart-actor: emits order events; this service consumes them. Perdocs/checkout-order-handoff.md, the ownership split is "cart-actor orchestrates active checkout, order-manager owns the persisted record."- RabbitMQ: exchanges per
docs/platform-event-messaging-sketch.md.
Improvement suggestions
- Too small to deserve its own service? Five files, one queue consumer, one model. Ask the deletion test: deleting this service would re-spread "what's an order?" across two repos. Currently earns its keep. Keep it, but periodically re-evaluate: if persistence moves into an outbox inside cart-actor, this service dilutes into a read API and may collapse.
capture.gois its own file but isn't clearly used —if it's only consumed by tests or an old webhook path, fold it intoorder.go.- No tests. The
OrderPlacedandUpdateHandlerinterfaces are the test surface; a 50-line test with a fakeUpdateHandlerwould lock in the contract thatgo-cart-actordepends on. - Single
deployment/order-manager.yamlhas no corollaries — if you're adding a second env (staging), copy it explicitly into adeploy/k8s/folder rather than hand-editing replicas later.