Urgent.News

What's breaking now, across thousands of outlets.

Tech

DAY 3 - SAGA Design Pattern

To manage distributed transactions across multiple microservices. It divides a large transaction into a series of smaller local transactions. Executed independently. Each service performs its own transaction via events or commands. If one transaction fails --> compensating actions are executed to undo previously completed operations. Distributed Transaction Multiple db or system working together…

Day 3: SAGA Design Pattern

The SAGA design pattern is utilized to manage distributed transactions across multiple microservices. It breaks down a large transaction into smaller local transactions, each executed independently by the respective service. Each service performs its transaction via events or commands.

In the event of a failure in one transaction, compensating actions are executed to undo previously completed operations. This pattern is employed to manage distributed transactions in microservices without relying on complex protocols like the 2-phase commit (2PC). The main advantage of SAGA is that it allows for the management of distributed transactions in microservices without using complex protocols like 2PC.

The working of SAGA involves dividing distributed transactions into a sequence of smaller transactions that execute independently across multiple services. There are two approaches to implementing SAGA: Choreography-Based Approach (Event-Driven) and Orchestration-Based Approach (Centralized).

In the Choreography-Based Approach, each service independently knows what to do and communicates through events using message queues or event streams. If a service fails, it publishes a failure event, and the other services perform compensating actions accordingly.

On the other hand, in the Orchestration-Based Approach, a SAGA Execution Coordinator (orchestrator) controls the flow of the transaction. The orchestrator tells each service when to start, what to do, and when to proceed to the next step. This approach can become complex as the system scales, and accidental event loops can occur.

Advantages of the SAGA design pattern include flexibility and scalability, as transactions can be executed independently without global locking. There are no single points of failure since transactions are distributed across multiple services. Additionally, the pattern provides fault tolerance through compensating actions to handle failures gracefully. Sagas embrace eventual consistency, meaning the system transitions through intermediate states, and the user experience remains transparent in a banking application.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Stop repeating HttpClient boilerplate in Angular

Set your API base URL and headers once with provideApi(), then inject(ApiService) anywhere. A tiny typed wrapper for Angular 17+.

  • Developers repeat same lines of code in every Angular service for REST API communication.
  • @arxis/api wrapper simplifies repetitive boilerplate code in Angular services.
  • Package provides typed methods for common HTTP operations while preserving HttpClient functionality.

Free AWS, Azure and GCP architecture icons as SVG

I queried the registry and counted. Amazon publishes 739 architecture icons, Microsoft 626, and Google 214. Together that is 1,579 icons across three download pages, three zip files, and three…

  • 1,579 architecture icons available across AWS, Azure, and GCP
  • Icons provided in 16, 32, and 64 pixel sizes, totaling 3,579 files
  • Icons licensed under CC-BY-ND-2.0 (AWS), MIT (Azure), and Apache-2.0 (GCP)

Why Most Type-Safe Validation Fails in Production (And How JEV Fixes It)

If you've shipped a production system that handles structured data — API payloads, form submissions, config files, event streams — you've probably hit this exact wall: Your validation logic works…

  • Validation in production lacks field-specific details
  • Type safety at compile time doesn't guarantee runtime confidence
  • JEV returns typed, structured decision objects for validation

More from Thursday 24 September →