Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungLINQ GroupBy: The Operator Everyone Uses Wrong(23.09.2026 um 09:41 Uhr)
Sichere ProgrammierungIT Heard About the Acquisition Nine Days Before It Closed(23.09.2026 um 09:45 Uhr)
Sichere ProgrammierungThe Story Behind Building NuvyntraLabs(23.09.2026 um 09:45 Uhr)
Sichere ProgrammierungFive dashboards nobody was opening(23.09.2026 um 09:46 Uhr)
Sichere ProgrammierungThe Shift from AI Insights to AI Actions in Finance(23.09.2026 um 09:47 Uhr)
Sichere ProgrammierungGo WebAssembly Meets WebForms Core 2.1(23.09.2026 um 09:49 Uhr)
Sichere ProgrammierungJust One More Round: Scope Creep in the Age of AI Agents(23.09.2026 um 09:50 Uhr)
Sichere ProgrammierungThe Calls That Reach Us Now Are the Ones the Model Could Not Answer(23.09.2026 um 09:50 Uhr)
Sichere ProgrammierungOne Loop Made Four Hundred Round Trips(23.09.2026 um 09:52 Uhr)
Sichere ProgrammierungThe order was committed and nothing else ever heard about it(23.09.2026 um 09:53 Uhr)
Sichere ProgrammierungLINQ GroupBy: The Operator Everyone Uses Wrong(23.09.2026 um 09:41 Uhr)
Sichere ProgrammierungIT Heard About the Acquisition Nine Days Before It Closed(23.09.2026 um 09:45 Uhr)
Sichere ProgrammierungThe Story Behind Building NuvyntraLabs(23.09.2026 um 09:45 Uhr)
Sichere ProgrammierungFive dashboards nobody was opening(23.09.2026 um 09:46 Uhr)
Sichere ProgrammierungThe Shift from AI Insights to AI Actions in Finance(23.09.2026 um 09:47 Uhr)
Sichere ProgrammierungGo WebAssembly Meets WebForms Core 2.1(23.09.2026 um 09:49 Uhr)
Sichere ProgrammierungJust One More Round: Scope Creep in the Age of AI Agents(23.09.2026 um 09:50 Uhr)
Sichere ProgrammierungThe Calls That Reach Us Now Are the Ones the Model Could Not Answer(23.09.2026 um 09:50 Uhr)
Sichere ProgrammierungOne Loop Made Four Hundred Round Trips(23.09.2026 um 09:52 Uhr)
Sichere ProgrammierungThe order was committed and nothing else ever heard about it(23.09.2026 um 09:53 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Simply Order (Part 7) – Querying Orders with Details: API Composition Pattern

This is the seventh article in our series, where we design a simple order solution for a hypothetical company called Simply Order. The company expects high traffic and needs a resilient, scalable, and distributed order system. In the…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

This is the seventh article in our series, where we design a simple order solution for a hypothetical company called Simply Order. The company expects high traffic and needs a resilient, scalable, and distributed order system.



In the previous articles:





In previous lessons, we built core services like Order, Payment, and Inventory, focusing on making our distributed transactions reliable using Sagas, the Outbox pattern, and Idempotency.



Now imagine the business comes with a very simple requirement:




On the Order Details page, show the order with its items, and for each item show the current stock status so customers know if they can re‑order.







The Problem



From a microservices perspective, our system looks like this:





  • Order Service owns orders and items by their SKU.


  • Inventory Service owns item details along with stock and availability per item.



Each service has its own bounded context, but users need to see their orders with the corresponding item details.






Solution 1: Direct client-to-microservice communication



Direct client-to-microservice



This is the simplest and most naïve solution: the frontend talks directly to the services:




  • Call GET /orders/{id} from the Order service.​

  • For each item in order, call GET /inventory/{sku} from the Inventory service



This leads to several problems:​




  • The frontend suddenly “knows” about internal service boundaries.

  • Latency explodes; a single order fetch could trigger dozens of calls based on the number of items, known as the N+1 Problem (1 order + N items).​

  • The frontend becomes tightly coupled with internal service APIs, so any change in service APIs requires changes in all frontend clients (webpages, mobile apps, third parties, etc.).



In short, this approach is unsuitable for a continuously evolving business and APIs.






Solution 2: API Composition



API Composition



In this approach we move the complexity of aggregating responses from different services into a separate service often called the Aggregator/Composer Service:




  • The frontend sends requests to the Composer Service.

  • The Composer Service calls multiple microservices (Order, Inventory, etc.).

  • It collects, transforms, and merges data into a unified result, returning it to the client.



With this approach, we can overcome the problems of the naive approach:




  • Internal service boundaries are hidden from the client API.

  • The aggregator service decouples the frontend from internal APIs, so even with evolving APIs, we can preserve our contract with clients.

  • With a smart implementation, we can optimize the N+1 problem.






Simple custom implementation



We build a thin service called Composer or Aggregator that, for each view of our data, provides a REST endpoint which aggregates all necessary endpoints and returns the corresponding result.



Some minor drawbacks of this approach:




  • We have to build separate endpoints for each view of our data. For example, if some pages need different details, we may need to create different endpoints to handle those.

  • It can get more sophisticated with retries, parallelism, mapping, and error handling.






API Composition with GraphQL



As mentioned in GraphQL official Page




GraphQL is an open‑source query language for APIs and a server‑side runtime. It provides a strongly‑typed schema to define relationships between data, making APIs more flexible and predictable. And it isn’t tied to a specific database or storage engine — it works with your existing code and data, making it easier to evolve APIs over time.



GraphQL serves as a unified data layer across multiple services. This way you simplify API management and reduce dependencies between teams. It enables efficient data fetching while keeping the API surface flexible and maintainable.




GraphQL is built around a few core components that work together to let clients request exactly the data they need from a single endpoint. Here’s a simple introduction to each main part:




  • Language: A query language letting clients request exactly the data they need.

  • Schema: Defines available data types, fields, and operations (queries, mutations, subscriptions).

  • Server: Processes queries, validates them against the schema, and returns results.

  • Resolvers: Functions that fetch data for each field in the schema.

  • Data Sources: Databases, APIs, or services where the actual data lives.



Together, these components allow GraphQL to unify data from multiple sources into a single, flexible API.




  • Rather than custom endpoints for each composite view, GraphQL exposes a type-based schema that lets clients specify exactly what data they want.

  • Resolvers act as the composition code—each field in the schema calls the appropriate microservice, then GraphQL merges all results for the client.



GraphQL can be implemented with different languages and frameworks. Spring Boot provides first-class support for GraphQL, making it easy to build type-safe, efficient APIs in Java.






Warp Up



In this article we moved from naive client‑to‑microservice calls to a proper composition layer, and then saw how GraphQL naturally fits as a unified API across our Order and Inventory services. Instead of creating custom endpoints for every page, a strongly‑typed schema and resolvers let clients ask for exactly the data they need from a single endpoint, without leaking internal boundaries.​



In the next article, we’ll take this one step further and implement this GraphQL composition layer using spring‑graphql on top of our existing microservices. We’ll design the schema around the “Order Details” use case, wire resolvers to Order and Inventory, and see how to handle cross‑service calls, errors, and performance concerns in a clean, type‑safe way

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Simply Order (Part 7) – Querying Orders with Details: API Composition Pattern

Thematisch verwandte Begriffe: Simply, Order, Part, Querying · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96258 | A vulnerability has been found in onSite internet GmbH Auktion NG Auktio…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick