Will be sharing some interesting project ideas to actually build and learn

  1. Arbiter : (Distributed Saga Pattern)

    Microservices break database transactions. We cannot do BEGIN TRANSACTION across three different services. Here ‘Saga’ (a state machine that can roll back), we can build a generic engine that confirms eventual consistency.

    The Challenging Part : Implementing compensating transaction. If step 1 (payment) succeeds but step 2 (inventory) fails, the Aribter must trigger ‘Refund’ logic for Step 1, even if the server crashes halfway through.

    (Steps ahead is an optional as I am more leaning towards Golang to build)

    • Fiber (Plays the role for trigger) : Accepts the request like Book trip
    • Redis (the state log) : we will be using redis streams to act as an immutable log events TransactionStarted, PaymentSuccess, InventoryFail .. Mainly this will allow us for having the ‘replay’ logic
    • gRPC (the executor) : calls the external microservices (Payment, Inventory) via gRPC. Crucially, it uses gRPC Interceptors to inject “Trace IDs” to track the saga across the network.