Side-by-side before/after: a single Spring Boot deployable with six in-process bounded contexts sharing one PostgreSQL schema and one ACID checkout transaction spanning five of them, versus six independent Quarkus services plus a GraphQL gateway, each owning its own schema, reached through one Camel REST edge router with a Kafka event backbone carrying the async and saga traffic.
Figure 0.1: The monolith this book starts with, and the six-service system it ends as
Download .excalidraw source
·
Edit on excalidraw.com
The six extractions in the order this book executes them, rising in difficulty left to right: review (REST leaf), notification (async outbox), inventory (CDC plus a gRPC seam), payment (choreographed saga), shipping (orchestrated saga), and order with its GraphQL gateway (CQRS plus GraphQL).
Figure 0.2: The extraction order: rising difficulty, not rising domain importance
Download .excalidraw source
·
Edit on excalidraw.com
The local toolchain split into required (JDK 25, Maven) and optional (Quarkus CLI, Camel CLI) pieces, the docker compose stack on Docker Engine (Postgres, Kafka in KRaft mode, the Grafana LGTM bundle), and the examples/, tooling/, demos/, infra/, scripts/, and _docs/ directories those two feed.
Figure 1.1: The local toolchain and the repository layout it builds, runs, and stands up.
Download .excalidraw source
·
Edit on excalidraw.com
The ledger's planning files mapped onto the ADLC's seven phases: the build plan and the per-iteration plan are produced during Plan, the status record is updated through Generate and Verify, and the decisions log plus the still-unwritten reconciliation log are written during Reconcile, which also loops back to update the build plan's own status line. Below that mapping, the resume mechanism: the status file's own 'Remaining (resume here)' line, read by the next session alongside the plan's step definitions.
Figure 2.1: The ledger's files, mapped onto the ADLC's phases, and how an interrupted session resumes from them
Download .excalidraw source
·
Edit on excalidraw.com
A ten-box grid of the microservice traits this chapter enumerates: independently deployable, modeled around a business domain, communicate over the network, a form of opinionated service-oriented architecture, technology agnostic, a distributed system as a set, API-focused, decentralized governance, decentralized data management, and designed for failure.
Figure 3.1: The ten microservice traits this book's extractions are built toward
Download .excalidraw source
·
Edit on excalidraw.com
A side-by-side risk-shape contrast. Left, the big-bang rewrite: three bets made at once (full behavioral understanding, outrunning decay, business patience for zero shipped value) feeding one irreversible cutover, with a late, all-or-nothing payoff. Right, the strangler fig: small steps starting with the review service, each proven equivalent before the next starts, running side by side with the monolith so any one step can pause, slow, or reverse without threatening the rest, with value shipping continuously.
Figure 3.2: One irreversible bet versus many reversible steps: the same migration, two risk shapes
Download .excalidraw source
·
Edit on excalidraw.com
A two-band comparison figure for the review-service extraction's measured metrics. Top band, startup time: Phase A JVM Spring-compat at 1.492 seconds, Phase B JVM idiomatic Quarkus at 1.431 to 1.437 seconds, and Phase B native image at 0.048 to 0.049 seconds, with the native bar roughly 31 times shorter than Phase A's. Bottom band, resident memory: Phase A at about 316 MB, Phase B JVM at about 304 MB, and Phase B native at about 73 MB, with the native bar roughly 4 times shorter than Phase A's. Every row carries the same 16 of 16 green equivalence-suite result.
Figure 3.3: Startup time and memory across Phase A, Phase B JVM, and Phase B native, same 16/16 equivalence suite throughout
Download .excalidraw source
·
Edit on excalidraw.com
Four migration strategies compared side by side: big-bang rewrite (highest risk, one long cutover), the strangler fig (this book's choice, incremental and independently verifiable), branch-by-abstraction (an in-process seam toggle), and parallel-run (a live comparison of two running paths).
Figure 4.1: The migration-strategy spectrum, from big-bang rewrite to the strangler fig
Download .excalidraw source
·
Edit on excalidraw.com
A strategic-value by change-frequency quadrant: Quick wins, Strategic re-architecture, Retain, and Reconsider/Repurchase, with this book's monolith plotted in the high-value, difficult-on-data quadrant that favors re-architecture.
Figure 4.2: The strategic-value x change-frequency quadrant this book's monolith sits in
Download .excalidraw source
·
Edit on excalidraw.com
Four snapshots of this book's own strangler-fig execution: the monolith alone, the proxy-fronted monolith with every call still passing through, the incrementally strangled state with review and notification live behind the proxy, and the fully extracted end state where the proxy is a flagless edge router in front of all six services and the monolith sits decommissioned and unwired.
Figure 4.3: The strangler fig's four stages, mapped onto this book's own six extractions
Download .excalidraw source
·
Edit on excalidraw.com
Two parallel eight-step cycles. Left, the traditional SDLC: requirements and planning (days-weeks), system design (weeks), implementation and coding (weeks-months), testing and QA (days-weeks), code review (days), deploy and release (days), monitoring and observability (ongoing), feedback and iteration (continuous), looping back to step one. Right, the agentic SDLC: express intent (minutes), agent understands (seconds), agent implements (minutes), agent tests and docs (minutes), human review (minutes-hours), deploy and ship (minutes), monitoring and observability (continuous), learn and iterate (ongoing), looping back to step one. A transformation arrow connects the two loops. Below, a Key Differences table: sequential handoffs becomes fluid agent flow; human codes everything becomes human guides, agent executes; docs as afterthought becomes docs generated inline; manual incident response becomes agent-assisted remediation.
Figure 5.1: The traditional SDLC (weeks to months, handoff-driven) and the agentic SDLC it is becoming (hours to days, human-guides/agent-executes)
Download .excalidraw source
·
Edit on excalidraw.com
Two stacked bands. Top band, labelled Deck: agentic SDLC (8 steps): express intent, agent understands, agent implements, agent tests and docs, human review, deploy and ship, monitoring and observability, learn and iterate. Bottom band, labelled Book: ADLC (7 phases): Frame, Map, Plan, Generate, Verify, Operate, Reconcile. Dashed lines map each top step down to the phase or phases it corresponds to: express intent to Frame, agent understands to Map, agent implements spanning both Plan and Generate, agent tests and docs to Generate, human review to Verify, deploy and ship and monitoring and observability both to Operate, learn and iterate to Reconcile. Two dark gate markers sit between the bands: GATE: plan approval between agent implements and Plan/Generate, and GATE: equivalence sign-off between human review and Verify.
Figure 5.4: Mapping the agentic SDLC's eight steps onto this book's seven-phase ADLC, with the two human gates marked where they land
Download .excalidraw source
·
Edit on excalidraw.com
An eight-step cycle, each step annotated with the generic tool role that carries it out: express intent: coding assistant (e.g. Claude Code); agent understands: local agent runtime; agent implements: local coding agent; agent tests and docs: local coding agent; human review: human; deploy and ship: internal developer platform (IDP); monitoring and observability: hosted AI platform; learn and iterate: issue tracker. Arrows connect each step to the next, cycling back to step one.
Figure 5.2: The agentic loop annotated with generic tool roles at each step
Download .excalidraw source
·
Edit on excalidraw.com
A shared outer path (express intent, learn and iterate, monitoring and observability, deploy and ship) flanked by two parallel inner bands covering agent understands through human review. The local band runs each step through a local agent runtime, a local coding agent plus Docker Engine, and a cloud dev environment. The hosted band runs the same steps through a hosted AI platform end to end. Both bands converge back onto the shared deploy-and-ship step.
Figure 5.3: The same agentic loop, run two ways: a local execution path (local coding agent plus a local container runtime) versus a hosted path (a managed, hosted AI platform)
Download .excalidraw source
·
Edit on excalidraw.com
Six boxes in a row: Frame (human, states intent, writes the decisions log entry), Plan tier (the planning model, reads Frame plus Map recon, drafts the step plan), Human gate 1 (plan approval, before any diff exists), Execute tier (the execution model, Generate: scaffolds, writes code and tests, runs them), Validate tier (the planning model again, adversarial: re-reads plan and diff against the equivalence suite), Human gate 2 (equivalence sign-off, Verify phase). A dashed line below the row connects the Plan and Validate boxes, labeled: same model tier, now adversarial, not self-vouching.
Figure 6.1: The relay: the planning model drafts, the execution model builds, the same planning tier validates adversarially, with a human gate on either side of Generate
Download .excalidraw source
·
Edit on excalidraw.com
Two stacked panels. Top: the structural gate, camel_validate_route and camel_configuration_validate, run during Generate before deploy; it confirms the route compiles into a legal Camel graph, catching a malformed choice/when/otherwise block, an unresolved component reference, or a typo'd endpoint parameter, the class of defect that surfaces as a confusing runtime stack trace. It cannot catch whether a routing predicate matches the right requests once real traffic flows. Bottom: the behavioral gate, the Newman equivalence suite plus its adversarial follow-up, run during Verify against a running service; it catches a routing predicate matching the wrong requests, the class of defect that surfaces as a misleadingly correct-looking response. A dashed line connects what the structural gate cannot catch to the behavioral gate that closes the gap.
Figure 6.2: The structural gate (camel-mcp route validation) and the behavioral gate (the equivalence suite) catch different classes of mistake; neither substitutes for the other
Download .excalidraw source
·
Edit on excalidraw.com
Two panels. Left: the Camel strangler proxy can route a request to the Spring monolith or the Quarkus review-service, but both read and write the same reviews table in the shared public schema, so a behavior-equivalence suite that only checks the HTTP response sees identical results either way. Right: the differential test that disambiguates them: stop the monolith, re-run the same route, and only the service the proxy's decision actually reaches can still answer; GET /api/reviews returns 200 from review-service while GET /api/orders still 500s against the dead monolith.
Figure 7.1: Why 49/49 green couldn't tell a routing bug from a correct cutover, and the test that could
Download .excalidraw source
·
Edit on excalidraw.com
Three stacked layers. Layer 1, automated: the Newman behavior-equivalence suite, re-run against every candidate build, which caught the native-image @RegisterForReflection gap; removing this layer lets that regression ship silently. Layer 2, adversarial verification: the differential test that stopped the monolith and asked whether the proxy's routing decision survives one backend being gone, which caught the routing defect hidden behind two backends sharing one table; removing this layer lets that defect ship 49-for-49. Layer 3, human judgment: plan approval and equivalence sign-off, which decide whether the first two layers' coverage is the right coverage for the stakes; removing this layer means a green suite run gets trusted as self-certifying.
Figure 7.2: The safety net's three layers, and the specific bug each one stops
Download .excalidraw source
·
Edit on excalidraw.com
A layered Spring Boot monolith: six bounded-context packages (order, inventory, payment, shipping, notification, review) each with a controller, service, and repository layer, all built against one shared PostgreSQL schema populated by Flyway migrations V1 and V2, exposed as one REST API surface documented by springdoc OpenAPI.
Figure 8.1: The reference monolith: six bounded contexts, one layered Spring Boot deployable, one shared schema
Download .excalidraw source
·
Edit on excalidraw.com
The monolith as designed: six in-process bounded-context modules (order, inventory, payment, shipping, notification, review) inside one Spring Boot deployable, with no process boundary, no network hop, and no per-context database between any of them.
Figure 8.2: Six bounded contexts, one deployable: modules, not services
Download .excalidraw source
·
Edit on excalidraw.com
OrderService#placeOrder as one Spring @Transactional spanning five bounded contexts in a single call stack: validate the customer, reserve stock, persist the order, charge payment, confirm, dispatch the shipment, and notify the customer; any failure partway through rolls back everything already written.
Figure 8.3: placeOrder, call by call: one transaction, five contexts
Download .excalidraw source
·
Edit on excalidraw.com
The shared-schema entity-relationship diagram: eight tables in one PostgreSQL schema, with customers and inventory_items referenced from multiple context-owned tables and nine foreign keys crossing bounded-context ownership lines freely.
Figure 8.4: One shared schema, nine foreign keys crossing context boundaries
Download .excalidraw source
·
Edit on excalidraw.com
All six planted smells overlaid on the monolith's six-context structure: the shared schema, the god OrderService, the one-transaction checkout, the synchronous notification call, the missing anti-corruption layer between order and inventory, and review's already-cured tangled security, each annotated with the chapter that cures it.
Figure 9.1: The six planted smells, mapped onto the monolith's structure
Download .excalidraw source
·
Edit on excalidraw.com
The monolith's three-tier test pyramid: Tier 1 unit tests (4 classes, Mockito, every collaborator mocked) prove a class's logic does the right thing; Tier 2 slice tests (6 classes, @WebMvcTest, service mocked) prove a controller binds, validates, and serializes correctly; Tier 3 integration tests (3 classes, real Postgres via Testcontainers) prove the code works against a real database. 13 classes, 41 @Test methods plus 1 parameterized test expanding to 4 executions, 45 executions total, all green on mvn verify.
Figure 10.1: The monolith's test pyramid: three tiers, thirteen classes, forty-five executions
Download .excalidraw source
·
Edit on excalidraw.com
Left, white-box: the Tier 1 through 3 pyramid calling monolith internals directly (OrderService, PaymentService, live Postgres rows) and unable to compile against a different implementation's class names. Right, black-box: the Newman behavior-equivalence suite, which sees only HTTP and targets a baseUrl collection variable, so the same unedited collection can point at the monolith today or a freshly extracted Quarkus service tomorrow.
Figure 10.2: White-box pyramid versus black-box equivalence suite: same system, two vantage points
Download .excalidraw source
·
Edit on excalidraw.com
A context map of the monolith's six bounded contexts: order's edge into inventory is conformist, with no anti-corruption layer at the seam, even though inventory's own StockDto contract already exists unused; order's edges into payment, shipping, and notification are direct synchronous calls inside one transaction, with no port; review has zero outbound edges to any sibling context; and all six sit on one Postgres schema, a shared kernel with no governed edges.
Figure 11.1: Context map: six bounded contexts, one relationship nobody decided
Download .excalidraw source
·
Edit on excalidraw.com
A hexagonal-architecture diagram: a domain core at center, holding entities, aggregates, and business logic, with no dependency on any web framework, ORM, or message broker; driving adapters (a REST controller, a gRPC service, a message consumer) each depending inward on an inbound port; driven adapters (a database repository, an event publisher) each depending inward on an outbound port the core declared.
Figure 11.2: Hexagonal architecture: ports and adapters, dependencies pointing inward
Download .excalidraw source
·
Edit on excalidraw.com
Two stacked readings of the checkout flow: the top band shows today's OrderService#placeOrder as one synchronous call chain inside a single @Transactional across inventory, payment, shipping, and notification; the bottom band shows the same business process re-read with the event-storming grammar: an actor and command producing an Order aggregate, a timeline of domain events (OrderPlaced, StockReserved, PaymentCaptured or PaymentDeclined, ShipmentDispatched, OrderConfirmed, NotificationSent) separated by policies and reactions, an external payment gateway, and an Order Status read model fed by the events.
Figure 12.1: The checkout flow, read two ways: one call chain today, a timeline of domain events once it's event-stormed
Download .excalidraw source
·
Edit on excalidraw.com
A seven-row legend card listing the event-storming note types in the order a session introduces them: domain event (orange sticky, a past-tense fact, e.g. OrderPlaced), command (blue sticky, the imperative that triggered it, e.g. Place Order), actor (small yellow figure left of its command, e.g. Customer), aggregate (large yellow sticky, the data cluster enforcing an invariant, e.g. Order), policy/reaction (lilac sticky, 'whenever X then issue command Y', no human actor), read model (green sticky, a view projected forward from events, e.g. Order Status), and external system (pink sticky, outside the team's control, e.g. the card network). Each row also names this book's house-style box type that stands in for the real sticky color.
Figure 12.2: The event-storming note-type legend: the wall's color grammar, named as the chapter calls it
Download .excalidraw source
·
Edit on excalidraw.com
A four-row table mapping each event boundary this chapter's storm found to its extraction chapter and mechanism: OrderPlaced to StockReserved (inventory's seam) to the Inventory extraction, CDC backfill plus a decomposed database; StockReserved to PaymentCaptured/PaymentDeclined (payment's seam) to the Payment extraction, a choreographed saga; PaymentCaptured to ShipmentDispatched (shipping's seam) to the Shipping extraction, an orchestrated saga using the Camel Saga EIP; and ShipmentDispatched to OrderConfirmed/NotificationSent (notification's seam, cut first) to the Notification extraction, a transactional outbox. A footnote box notes OrderService itself is cut last in the Order extraction, after all four boundaries already fire events, and that the anti-corruption layer is the precondition at every row.
Figure 12.3: From the storm wall to the extraction backlog: each boundary, its chapter, and its mechanism
Download .excalidraw source
·
Edit on excalidraw.com
The Constantine coupling ladder drawn as seven stacked rungs, worst to best, each paired with its monolith example. Content coupling: OrderService#placeOrder reading a live, JPA-managed InventoryItem's priceCents and sku straight from findBySkuOrThrow (Smell 5). Common coupling: one shared Postgres schema across order, inventory, payment, shipping, notification, and customers (Smell 1). Control coupling: OrderCreate.paymentMethod() threaded into PaymentService#charge, selecting an approve-or-decline code path. Stamp coupling: OrderItem's constructor taking the full InventoryItem entity for the three fields it needs. Data coupling: OrderService.listAll() returning List<OrderDto> via toDto, already done right. Message coupling and API/data-structure coupling have no monolith example: they are the target architecture chapters 14 through 26 build.
Figure 13.1: The Constantine coupling ladder, worst to best, each rung pinned to its monolith example
Download .excalidraw source
·
Edit on excalidraw.com
A directed dependency graph of the six contexts. Order sits at the center with four outbound edges (OrderService's calls into inventory, payment, shipping, and notification, its efferent coupling of four) and three inbound foreign-key edges from payment, shipment, and notification back to order, its afferent coupling. Inventory also carries a data-level edge from order via OrderItem's foreign key into InventoryItem. Review has no edges in or out. A dashed edge from shipping to payment marks the dependency shipping only gains once payment is extracted. Below, the same six contexts sorted into the resolved extraction order: review, notification, inventory, payment, shipping, then order, lowest Ca/Ce first.
Figure 13.2: The six contexts' dependency graph, scored by Ca/Ce, resolving into the extraction order
Download .excalidraw source
·
Edit on excalidraw.com
Two stacked diagrams showing the Camel strangler proxy before and after the Review cutover: before, the proxy forwards /api/reviews traffic to the Spring monolith; after, the flag strangler.review.enabled routes that traffic to the Quarkus review service instead, with the monolith's Review module decommissioned.
Figure 14.1: The strangler proxy before and after the Review cutover: one Camel route, one flag, two backends.
Download .excalidraw source
·
Edit on excalidraw.com
The strangler fig pattern's four moves in order, intercept, route, incrementally replace, retire, shown as a reversible zone spanning the first three moves (both backends still exist, the flag can flip either direction) and a separate irreversible zone at retire. A dashed warning path shows what happens if retire is reached before a stop-the-old-system check passes: the fallback is gone and the migration quietly becomes a big-bang rewrite.
Figure 14.2: The four moves, in order: intercept, route, incrementally replace, retire. The window stays reversible through move three; retire is the one move that closes it, and it only belongs last.
Download .excalidraw source
·
Edit on excalidraw.com
A three-stage flow: Phase A, lift onto Quarkus using the Spring-compatibility extensions (quarkus-spring-web, quarkus-spring-di, quarkus-spring-data-jpa); an arrow labeled 'refactor off Spring-compat' to Phase B, idiomatic Quarkus with the compat shim removed (Quarkus REST, Panache, CDI); an arrow labeled 'container-based native build, about 75 seconds' to a native-image box. Below, a measured table: Phase A JVM 1.492s startup / about 316MB RSS; Phase B JVM 1.431 to 1.437s / about 304MB RSS; Phase B native image 0.048 to 0.049s / about 73MB RSS. Same Postgres, profile=prod.
Figure 15.2: The two-phase migration template, with the measured before/after that makes the native-image case
Download .excalidraw source
·
Edit on excalidraw.com
A cross-shaped diagram centered on InventoryAclRoute's enrich() step. The horizontal axis is content-based routing: .choice() on strangler.inventory.enabled selects the monolith's /api/inventory/{sku} endpoint on :8080 today, or inventory's own gRPC service on :9004 from the Inventory extraction onward. The vertical axis is the anti-corruption layer: the raw reply from whichever backend answered feeds into a StockDtoTranslatingStrategy that always produces StockDto. The two axes cross at one physical seam but answer independent questions.
Figure 16.1: One seam, two orthogonal questions: which backend answers, and what is safe to carry back
Download .excalidraw source
·
Edit on excalidraw.com
A left-to-right pipeline through InventoryAclRoute: an exchange arrives on direct:stockFor knowing only a SKU; .choice() on strangler.inventory.enabled resolves a backend URI, either the monolith's REST endpoint or, from the Inventory extraction on, inventory's own gRPC service; .enrich() performs a request-reply fetch against that URI; StockDtoTranslatingStrategy.aggregate() converts the reply via StockDtoTranslator.translate() and merges StockDto onto the original exchange; the exchange leaves the route knowing the stock fact.
Figure 16.2: The ACL pipeline: a SKU goes in, StockDto comes out, regardless of which backend answered
Download .excalidraw source
·
Edit on excalidraw.com
A two-panel comparison. Left, today: order.OrderService#placeOrder calls inventoryService.findBySkuOrThrow(sku) as an ordinary in-process Java call and holds InventoryItem, a JPA @Entity owned by inventory's own EntityManager, a compile-time import of inventory's persistence class. Right, through the ACL: the same call goes through producerTemplate.requestBodyAndHeader against direct:stockFor and returns StockDto, a plain record with no persistence annotations and no compile-time dependency on InventoryItem at all.
Figure 16.3: What crosses the seam: a raw @Entity import versus a plain-record contract
Download .excalidraw source
·
Edit on excalidraw.com
The end-to-end async notification pipeline: a client through the Camel strangler proxy to the Spring monolith, whose checkout transaction writes an order row and an order.placed outbox row atomically; a scheduled relay polls the outbox and publishes to Kafka; the Quarkus notification service runs two SmallRye consumers off that topic, one persisting idempotently into its own schema, one pushing over a WebSocket; the proxy's read route forwards /api/notifications straight to the new service.
Figure 17.1: The notification extraction's async topology: outbox write, polling relay, two Kafka consumers, own schema, WebSocket push
Download .excalidraw source
·
Edit on excalidraw.com
Two stacked sequences. Top: the old flow, checkout running inventory-reserve, order-persist, payment-charge, shipping-dispatch, then calling NotificationService#sendOrderConfirmation synchronously inside the same @Transactional before commit. Bottom: the new flow, the same checkout steps but the last write before commit is an order.placed outbox row in the same transaction; a separate, later, asynchronous OutboxRelay polls for unpublished rows, publishes to Kafka, and stamps published_at only after the broker acks, with the idempotent consumer absorbing at-least-once redelivery.
Figure 17.2: The transactional outbox sequence: one atomic commit, then a decoupled, at-least-once publish
Download .excalidraw source
·
Edit on excalidraw.com
Before and after: on the left, one shared schema where order_items holds a live FK join into inventory_items, which is why a SKU rename silently relabels every historical order's display; on the right, inventory owns its own database, the FK is dropped, order_items gains sku and product-name snapshot columns written once at order-placement time, and a CDC connector backfills inventory's new database by tailing the old schema's write-ahead log.
Figure 18.2: order_items -> inventory_items: a live FK join today, a snapshot plus a CDC event feed after the Inventory extraction
Download .excalidraw source
·
Edit on excalidraw.com
The inventory extraction's steady-state topology: a client through the Camel strangler proxy to either the Spring monolith's checkout or the Quarkus inventory service's own schema; the monolith's OrderService reserves and releases stock over a synchronous gRPC seam against the inventory service's own database; a retired Debezium CDC path at the bottom shows the one-time backfill that seeded that database during the transition window.
Figure 19.1: The inventory extraction's steady-state seam (synchronous gRPC Reserve/Release) and the now-retired CDC backfill path that got the owned database there
Download .excalidraw source
·
Edit on excalidraw.com
The CDC backfill pipeline's mechanism, left to right: the monolith's Postgres WAL (wal_level=logical, pgoutput, REPLICA IDENTITY FULL), the mea_inventory_slot replication slot and mea_inventory_publication publication registered on it, the mea-inventory-connector Debezium connector reading that feed (snapshot.mode=initial, emitting op=r backfill events once then streaming op=c/u/d), the mea.public.inventory_items Kafka topic, and InventoryCdcConsumer's idempotent ON CONFLICT upsert into the inventory service's own schema. A second band shows the slot and publication's retirement: scripts/retire-debezium.sh, run once at cutover, deletes the connector and drops both the slot and the publication.
Figure 19.3: The CDC backfill pipeline's mechanism (WAL through the replication slot, the Debezium connector, and the Kafka topic, to InventoryCdcConsumer's idempotent upsert), and the slot/publication's one-time retirement at cutover
Download .excalidraw source
·
Edit on excalidraw.com
Two stacked sequence diagrams: the old flow where a single in-process ACID transaction rolls back a payment decline's inventory decrement automatically; the new flow where Reserve commits in the inventory service's own database outside the monolith's transaction, so a payment decline must trigger an explicit compensating Release instead.
Figure 19.2: Reserve/Release, the cross-seam saga-lite that replaces the in-process free rollback a shared transaction used to provide
Download .excalidraw source
·
Edit on excalidraw.com
The dual-write hazard versus the transactional outbox, stacked for contrast: on top, saving to the database and publishing to Kafka as two independent writes with a gap nothing closes; on the bottom, the business write and the outbox row committing together in the same transaction, with the second hop to Kafka made explicit and owned by the relay.
Figure 20.1: Dual-write versus the transactional outbox
Download .excalidraw source
·
Edit on excalidraw.com
The outbox pattern's four pieces as one labeled flow: the write that persists the outbox row inside placeOrder's transaction, the relay that polls for unpublished rows and publishes them to Kafka, the broker topic the relay blocks on for acknowledgment, and the idempotent consumer that checks before inserting.
Figure 20.2: The outbox pattern's four pieces: write, relay, broker, consumer
Download .excalidraw source
·
Edit on excalidraw.com
OrderService.placeOrder's Order aggregate as the write model, publishing order.placed through the outbox; notification-service's Notification entity as the CQRS read model it feeds; a dashed, not-yet-built box marks the GraphQL gateway read model.
Figure 21.1: CQRS: one write model, one or more read models, grounded in notification-service.
Download .excalidraw source
·
Edit on excalidraw.com
Side by side: this book's CQRS-lite, where the Order aggregate stays mutable rows and notification-service folds one published fact into a row, versus full event sourcing, drawn as illustrative only, where an append-only log is the system of record and current state is computed by replay.
Figure 21.2: CQRS-lite, as this book builds it, against full event sourcing, shown for contrast only.
Download .excalidraw source
·
Edit on excalidraw.com
The ACID-to-ACD spine: on top, OrderService#placeOrder's single transaction rolling back every extracted context automatically, with no compensating code written for it; on the bottom, each service keeping full local transactions inside its own database while cross-service atomicity and isolation are gone, replaced by an explicit compensating action a saga runs instead of a database rollback.
Figure 22.1: What ACID gives up at the seam, and what a saga rebuilds
Download .excalidraw source
·
Edit on excalidraw.com
The full choreographed saga sequence: a client posts to the strangler proxy, which forwards to the monolith; OrderService reserves stock synchronously over gRPC, persists the order PENDING, writes an order.placed outbox row in the same transaction, and returns 202 Accepted. The monolith's OutboxRelay later publishes order.placed to Kafka. The payment service's OrderPlacedConsumer reacts, charges idempotently, and writes CAPTURED or DECLINED to its own outbox in the same transaction as the Payment row; its own PaymentOutboxRelay publishes payment.captured or payment.declined to Kafka. The monolith's OrderSagaListener consumes that topic: on capture it confirms the order and dispatches shipping; on decline it marks the order PAYMENT_DECLINED and issues a compensating gRPC Release against the inventory service.
Figure 23.1: The choreographed saga, end to end: one synchronous reservation, two asynchronous outboxes, no central coordinator
Download .excalidraw source
·
Edit on excalidraw.com
Side-by-side before and after of the checkout HTTP contract. Before: placeOrder reserves stock, charges payment in-process, confirms the order, and dispatches shipping, all before the response; the POST returns 201 Created with status CONFIRMED, or 402 Payment Required with nothing persisted. After: placeOrder still reserves stock synchronously, but persists the order PENDING and returns 202 Accepted plus a Location header immediately; the terminal status, CONFIRMED or PAYMENT_DECLINED, is reached later over the choreography, and the client polls GET /api/orders/{id} to observe it.
Figure 23.2: The checkout contract, before and after: the same three-value OrderStatus vocabulary, decided synchronously versus observed by polling
Download .excalidraw source
·
Edit on excalidraw.com
Two stacked diagrams contrasting compensation styles. Top, the Inventory-extraction shape: OrderService's own try/catch calls the compensating gRPC Release directly on the same request thread the moment an in-process payment charge throws. Bottom, the Payment-extraction shape: there is no request-thread catch for a payment decline anymore; the payment service emits payment.declined via its own transactional outbox, the monolith's OrderSagaListener consumes it across two asynchronous hops, and the reaction issues the same compensating gRPC Release, converging to net-zero stock either way.
Figure 23.3: Compensation, before and after: from a request-thread catch to a two-hop choreographed reaction, same compensating call, same net-zero result
Download .excalidraw source
·
Edit on excalidraw.com
The full happy-and-failure flow for the orchestrated shipping saga. Bands A and B are unchanged from chapters 19 and 23: a synchronous gRPC Reserve, an order persisted PENDING with an order.placed outbox row, and the payment service's own choreography emitting payment.captured or payment.declined through its own transactional outbox. Band C is new. Two independent consumer groups react to payment.captured at once: the monolith's OrderSagaListener moves the order to AWAITING_SHIPMENT and does not dispatch in-process, while the shipping service's Camel Saga EIP coordinator starts, sequencing enrich, dispatch, book-carrier, and emit. Band D, success: the coordinator emits shipment.dispatched through its own outbox and the monolith's onShipmentDispatched reaction confirms the order. Band E, failure: the deterministic SHIP-FAIL sentinel makes book-carrier throw, the same coordinator invokes its one registered compensation route exactly once, cancelling the shipment and emitting shipment.failed, and the monolith's onShipmentFailed reaction marks the order SHIPPING_FAILED and issues the compensating gRPC Release for every reserved sku.
Figure 24.1: The orchestrated shipping saga, end to end: one coordinator, two consumer groups reacting to the same event, one compensating action invoked exactly once
Download .excalidraw source
·
Edit on excalidraw.com
Side by side on one codebase. Left, the choreographed payment saga: no central box; the payment service's OrderPlacedConsumer and PaymentService, and the monolith's OrderSagaListener, each independently subscribe to Kafka topics and decide on their own what their reaction means for the order; control is emergent. Right, the orchestrated shipping saga: a single Camel Saga EIP coordinator explicitly sequences enrich, dispatch, book-carrier, and emit, and owns the one registered compensating action; control is centralized and visible in one route that reads top to bottom, and the monolith reacts only to the outcome, never deciding what fulfilment step runs next.
Figure 24.2: Orchestration vs. choreography, on the same codebase: a coordinator that decides, versus three reactions that only emerge into a sequence
Download .excalidraw source
·
Edit on excalidraw.com
Three stacked bands, each converging to net-zero stock, showing how the trigger for compensation changes while the inventory undo stays the same gRPC call. Top, the Inventory extraction: compensation runs from an in-line catch, on the same request thread, the instant an in-process payment charge throws. Middle, the Payment extraction: no request-thread catch exists; a payment decline is discovered by reacting to the payment.declined event across two asynchronous hops, with no coordinator. Bottom, the Shipping extraction: the Camel Saga EIP coordinator is coordinator-initiated: it is the process running the step that throws, so it invokes its registered compensation route immediately, in-process; only the cross-context part, releasing inventory the shipping service does not own the snapshot for, is delegated onward via shipment.failed to the order context, which performs the actual compensating Release.
Figure 24.3: Compensation across three chapters: a request-thread catch, a choreographed reaction, and a coordinator-initiated compensation that only delegates the part it cannot perform locally
Download .excalidraw source
·
Edit on excalidraw.com
A checkout thread's call to RemoteInventoryClient#reserve branches into three outcomes once it crosses the gRPC boundary: returns a ReserveReply, throws a StatusRuntimeException mapped to a 500, or never returns at all. The never-returns branch leads to a blocked thread holding its pool slot and, without a bound in place, cascading failure as enough blocked threads exhaust the pool. A ghost box shows the deadline that bounds this outcome in this project's own code today.
Figure 25.1: A gRPC call's third outcome, and the cascading-failure path a deadline cuts off
Download .excalidraw source
·
Edit on excalidraw.com
The circuit breaker state machine: closed, where calls flow through normally; open, where calls fail immediately without attempting the network round-trip once a failure threshold trips; and half-open, where a trial call checks whether the dependency has recovered before the breaker closes again or a failed trial re-opens it. A dashed callout marks RemoteInventoryClient#reserve and #release as where this would wrap, and notes that no @CircuitBreaker annotation exists in this codebase today.
Figure 25.2: The circuit breaker's closed/open/half-open state machine, named here and not yet built
Download .excalidraw source
·
Edit on excalidraw.com
A two-column scorecard. Left, implemented and proven by a negative check: the per-call gRPC deadline, at-least-once delivery paired with two-layer idempotent consumption, the explicit compensating action in place of rollback, transparent un-degraded failure propagation at the proxy, and MicroProfile Health endpoints on both Quarkus services. Right, deferred by design with a stated reason: a circuit breaker, a bulkhead, retry backoff/jitter/cap on the outbox relay, a dead-letter path, platform-level consumption of the health endpoints, and an idempotency key on the compensating Release call.
Figure 25.3: The resilience scorecard; what this project built, and what it left for measured traffic to justify
Download .excalidraw source
·
Edit on excalidraw.com
The final end-state topology. The Camel strangler proxy on :8888 has shed its strangler role and become a permanent REST and GraphQL edge router: the content-based routing collapses to straight per-context forwarding, with every strangler.*.enabled cutover flag retired. One client entry point reaches all six extracted Quarkus services: review :8081, notification :8083, inventory :8084/:9004, payment :8085, order :8087, shipping :8088, plus the GraphQL gateway at :8090, itself a pure aggregation layer over five of those six. The Spring monolith at :8080 stands alone, unwired, removed from the running topology but kept frozen in the repository as the golden-baseline referent the contract suite was built from.
Figure 26.1: The final topology: six independently deployable services, a GraphQL gateway, a flagless edge router, and a frozen, unwired monolith
Download .excalidraw source
·
Edit on excalidraw.com
The CQRS write/read split inside the order service. Top band, the command path: POST /api/orders drives placeOrder, which validates the customer, reserves every line over synchronous gRPC, persists the Order/OrderItem write-model aggregate PENDING, and writes order.placed to the service's own transactional outbox, all in one transaction; OrderOutboxRelay later relays the row to Kafka. Middle band, the projection: placeOrder itself, and each of OrderSagaListener's four lifecycle reactions, call the same OrderViewProjector inside their own transaction to upsert the denormalized order_view read model: two distinct tables in one schema, never joined at read time. Bottom band, the query path: getById and listAll read exclusively from the order_view repository; the write-model repository is never consulted for a read, and the GraphQL gateway's order(id) query reaches this same REST read path like any other client.
Figure 26.2: The CQRS split: one command path, one projection, one query path that never touches the write model
Download .excalidraw source
·
Edit on excalidraw.com
One order(id) GraphQL query, fanned out by the gateway on :8090 to five already-extracted services. GatewayApi.order(id) resolves the order itself over REST from order-service at :8087. The fields nested on that result are each a lazy @Source resolver, evaluated only when selected: payments to payment service over REST at :8085, shipments to shipping service over REST at :8088, and per line item, reviews to review service over REST at :8081 and stock to inventory service over gRPC at :9004, the one non-REST hop. The gateway holds no state and owns no data; every field is fetched live from the service that owns it, never cached locally, and every downstream target is fixed operator configuration with query depth and complexity bounded.
Figure 26.3: One query, five backends, no local data: the gateway as a pure aggregation layer
Download .excalidraw source
·
Edit on excalidraw.com
A two-column scorecard of the MicroProfile/Quarkus chassis this migration actually wired in. Left column, used or partially used: Config via @ConfigProperty and profile-aware properties across every service; REST Client via typed, config-driven clients in shipping and the gateway; build-time optimization and the native image, with the measured ~31x startup and ~4x memory payoff; the quarkus:dev inner loop with Dev Services switched off at the datasource layer by stated choice; Health on six of eight services with no platform consumer yet; and Security as HTTP Basic plus @RolesAllowed on exactly one route. Right column, deferred with a stated reason: Fault Tolerance (no annotations, no dependency, manual deadlines standing in); Metrics (no Micrometer, deferred to the mesh work); OpenAPI on the Quarkus side (dropped from the monolith's springdoc surface, partially replaced by the gateway's GraphQL schema); and JWT/OIDC (no token-based identity anywhere in the system).
Figure 27.2: The chassis scorecard: what this migration wired in, and what it left on the shelf
Download .excalidraw source
·
Edit on excalidraw.com
Two side-by-side panels. Left, 'today': three independent Java records: order-service's seven-field OrderPlacedEvent, payment-service's matching seven-field copy, and notification-service's six-field copy missing paymentMethod, each hand-authored against the same intended JSON shape, with a drift arrow pointing at notification's missing field. Right, 'the registry demonstrator': one order-placed-v1.avsc record registered once with Apicurio, a producer and a consumer both generated from it, with a compatibility rule standing between any future version and the registry that would reject a breaking change before it ships.
Figure 28.1: Three hand-duplicated, silently drifting records versus one registry-governed schema (demonstrated in parallel; the live flows don't depend on it)
Download .excalidraw source
·
Edit on excalidraw.com
A left-to-right sequence. OrderAvroProducer sends an OrderPlaced SpecificRecord through the order-avro-out channel; AvroKafkaSerializer auto-registers the schema with Apicurio (artifact order.events.avro.demo-value) and prefixes the Kafka message with a global schema id. Apicurio stores the schema under that id and, because a BACKWARD compatibility rule is attached, enforces it on every later version: a v2 that adds giftMessage with a default returns HTTP 200 and is accepted; a v3 that retypes totalCents from long to string returns HTTP 409 RuleViolationException and is rejected. OrderAvroConsumer's AvroKafkaDeserializer reads the id off an accepted message, fetches the matching schema from Apicurio, and deserializes back into a field-equal OrderPlaced instance.
Figure 28.2: The contract flow (auto-register, store and enforce, fetch by id, deserialize), with the v2 accepted / v3 rejected outcomes that make enforcement concrete
Download .excalidraw source
·
Edit on excalidraw.com
A Kubernetes namespace diagram for the mea namespace. Eight application Deployments (strangler-proxy: edge router, NodePort-exposed, port 8888; review-service: 8081; notification-service: 8083; inventory-service: 8084 HTTP plus 9004 gRPC; payment-service: 8085; shipping-service: 8088; order-service: 8087; and graphql-gateway: 8090 HTTP plus 9093 gRPC), each paired with its own ClusterIP Service, all labeled app.kubernetes.io/part-of: mea. Two StatefulSets, postgres and kafka, each behind a headless Service, sit alongside the Deployments as shared in-cluster infrastructure. A ConfigMap (mea-app-config) and a Secret (mea-postgres-app) feed every Deployment. Arrows show strangler-proxy fanning out to all six bounded-context services (review, notification, inventory, payment, shipping, order), order-service calling inventory-service over gRPC, graphql-gateway calling four services over REST and inventory-service over gRPC, and the five Kafka-consuming services (notification, inventory, payment, shipping, order) connecting to the kafka StatefulSet; the six schema-owning services connect to the postgres StatefulSet.
Figure 29.1: The mea namespace: eight application Deployments, two infrastructure StatefulSets, one ConfigMap/Secret pair, one NodePort entry point
Download .excalidraw source
·
Edit on excalidraw.com
A wiring diagram centered on one Deployment pod template (notification-service) showing both the configuration path and the probe path. Configuration path: the mea-app-config ConfigMap feeds the pod two ways, a blanket envFrom block and one explicit QUARKUS_DATASOURCE_JDBC_URL env entry sourced via configMapKeyRef from the per-service NOTIFICATION_SERVICE_JDBC_URL key, labeled 'ordinal override: env ConfigSource (300) beats application.properties PropertiesConfigSource (250)'; the mea-postgres-app Secret feeds QUARKUS_DATASOURCE_USERNAME/PASSWORD via secretKeyRef. Probe path, shown as two contrasting pod templates side by side: notification-service (quarkus-smallrye-health on the classpath) wired to three httpGet probes against /q/health/started, /q/health/ready, /q/health/live; review-service (no quarkus-smallrye-health) wired to three tcpSocket probes against the same HTTP port, with a note that tcpSocket only proves the listener is up, not that routing or the database connection works.
Figure 29.2: Configuration reaching a pod via ordinal-override env vars, and the probe split between the six health-enabled services and the two that use tcpSocket instead
Download .excalidraw source
·
Edit on excalidraw.com
A multi-pod view of the mea namespace. An external client enters over NodePort :8888 (plaintext, unmeshed) to strangler-proxy; then sidecar-to-sidecar mTLS (STRICT) hops carry strangler-proxy to order-service and graphql-gateway to order-service (REST :8087) and inventory-service (gRPC :9004). Each app pod holds an application container plus an istio-proxy Envoy sidecar: four pods shown in full and four more summarized. Every sidecar ships telemetry to an unmeshed lgtm Deployment, and postgres and kafka sit outside the mesh with no sidecar.
Figure 30.1: The mesh data path: each app pod pairs its container with an Envoy sidecar, and sidecar-to-sidecar hops carry mTLS, access logs, and trace spans without the application's involvement
Download .excalidraw source
·
Edit on excalidraw.com
A two-band diagram. Top band: spans and metrics flow from application containers (app-level OpenTelemetry on graphql-gateway, order-service, and inventory-service) and from istio-proxy sidecars across the mea namespace, through the OpenTelemetry Collector's OTLP and Prometheus-scrape receivers, into Tempo (traces) and Mimir (metrics) inside the single lgtm Deployment, with Loki (logs) drawn as configured-but-not-live; Grafana reads all three. Bottom band: the captured trace, root graphql-gateway POST /graphql fanning into an order-service REST branch and an inventory-service gRPC branch, with app-level spans nested inside Envoy sidecar spans at their real durations.
Figure 30.2: From sidecar and app spans to a queryable trace: the OTLP and Prometheus paths into the lgtm Deployment, and the shape of the trace they produced
Download .excalidraw source
·
Edit on excalidraw.com
A git push fans into three real GitHub Actions workflow files: code-ci.yml (seven behavior gates: the equivalence gate on the monolith baseline, the four per-seam equivalence gates, the order/gateway contract gate, and the schema-registry gate), supply-chain.yml (the provenance gate: mvn package then syft SBOM then grype scan then policy.yaml fail-on High), and pages.yml (build and deploy the Jekyll site). To the right, three dashed ghost boxes mark the deferred rest of a GitOps delivery chain: pushing images to a registry, a GitOps operator (Argo CD or Flux) reconciling deploy/k8s into the cluster, and Istio weighted canary.
Figure 31.1: The delivery pipeline this repo ships: behavior gates and a provenance gate that run; drawn against the registry-push/GitOps/canary chain it names but does not yet run
Download .excalidraw source
·
Edit on excalidraw.com
One three-step gate with two inputs. The monolith fat jar (before) and the order-service Quarkus runtime closure (after) both flow into step 1, syft, which emits a CycloneDX SBOM; into step 2, grype, which scans that SBOM against its vulnerability database (built 2026-10-06, labelled a moving target); into step 3, policy.yaml with fail-on High. The monolith branch ends in a FAIL box (4 Critical, 6 High, 8 Medium, 78 components, non-zero exit), the order-service branch in a PASS box (0/0/0, 522 components, exit 0).
Figure 31.2: The same gate over the 'before' and the 'after': the monolith fails it, the modernized service passes it; the modernization made measurable
Download .excalidraw source
·
Edit on excalidraw.com
A four-column scorecard grouping the patterns the book walked by concern. Decomposition: Strangler Fig, Bounded Context/DDD, Anti-Corruption Layer (all used in anger), Branch by Abstraction (adapted). Data: Database per Service, Transactional Outbox, Change Data Capture (used), Event Sourcing/CQRS (CQRS used, full ES deferred). Communication & Contracts: choreographed Saga, orchestrated Saga, API Composition/GraphQL (used), Schema Registry (used, isolated). Reliability/Ops/Chassis: Microservice Chassis, Service Mesh + Tracing, Supply-chain + CI gates (used), Reliability patterns (used where earned, circuit breaker deferred). A bottom row of dashed ghost boxes marks what was left on the shelf: rewrite/big-bang, full event sourcing, LRA/Narayana saga, GitOps operator + canary.
Figure 32.1: The pattern language re-walked, where each pattern landed and the verdict; every box is a claim verified in its own chapter
Download .excalidraw source
·
Edit on excalidraw.com
A left-to-right spectrum from one monolith (too coupled) through a modular monolith, to a highlighted right-sized band of six context-aligned services plus a graphql-gateway where this project landed, to finer-grained services, to nanoservice sprawl / distributed monolith (too chatty) at the far right. A spectrum arrow labelled 'more, smaller services' runs beneath, with 'too coupled' at the left end and 'too chatty' at the right.
Figure 32.2: The over-decomposition spectrum, the goal is context-aligned services, not maximal splitting; past the sweet spot lies the distributed monolith
Download .excalidraw source
·
Edit on excalidraw.com