<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aakash Shar on Medium]]></title>
        <description><![CDATA[Stories by Aakash Shar on Medium]]></description>
        <link>https://medium.com/@aakashshar?source=rss-472b0455ef54------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YvFL0IlfSUfrNCkp</url>
            <title>Stories by Aakash Shar on Medium</title>
            <link>https://medium.com/@aakashshar?source=rss-472b0455ef54------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 20:23:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aakashshar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Robust Maker–Checker Workflow Using Temporal and Java SDK]]></title>
            <link>https://medium.com/@aakashshar/building-a-robust-maker-checker-workflow-using-temporal-and-java-sdk-7ec49c3c3c4e?source=rss-472b0455ef54------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ec49c3c3c4e</guid>
            <dc:creator><![CDATA[Aakash Shar]]></dc:creator>
            <pubDate>Mon, 17 Nov 2025 08:38:20 GMT</pubDate>
            <atom:updated>2025-11-17T08:38:20.619Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s enterprise systems — especially in banking, finance, and payments — <strong>maker–checker</strong> (also known as the <em>four-eyes principle</em>) is a mandatory control mechanism. Any high-risk or high-value operation must be initiated by one user (Maker) and approved or rejected by another (Checker).</p><p>However, implementing this reliably in traditional Java systems is challenging:</p><ol><li>Long-running approvals</li><li>Handling system restarts</li><li>Retries and timeouts</li><li>Human-in-the-loop workflows</li><li>Ensuring auditability and consistency</li></ol><p>This is where <strong>Temporal</strong> shines.</p><p>Over the past several months, I implemented a complete <strong>Maker–Checker approval framework</strong> using <strong>Temporal Java SDK</strong> for multiple bank solution corporate and retail applications — including fund transfers, beneficiary management, term deposits, and government/tax payments.</p><p>This article walks through the architecture, workflow design, Java code structure, and the key lessons learned.</p><h3>Why Temporal for Maker–Checker?</h3><p>Here’s why Temporal is a perfect fit:</p><p>Stateful, durable workflows without manual DB management</p><p>Built-in retries, backoff, and timeout handling</p><p>Human-in-the-loop support via workflow signals</p><p>Distributed, cloud-native architecture</p><p>Full workflow history for audit and compliance</p><p>Traditional Java solutions require custom state machines, cron jobs, and complex DB workflows. Temporal eliminates all of that with a durable workflow engine.</p><h3>Solution Overview</h3><p>The Maker–Checker model is implemented using:</p><h3>1. Workflow (MakerCheckerWorkflow)</h3><p>Handles the lifecycle:</p><ol><li>Create request as Workflow</li><li>Wait for Checker actions</li><li>Execute approved actions</li><li>Update records and notify</li></ol><h3>2. Activities (MakerCheckerActivities)</h3><p>Perform business operations:<br> — Persist request<br> — Fetch or validate details<br> — Execute transactions<br> — Update statuses<br> — Send notifications</p><h3>3. Spring Boot Service Layer</h3><p>Responsible for:</p><ul><li>Starting workflows</li><li>Signaling approval/rejection</li><li>Managing lifecycle status</li></ul><h3>High-Level Architecture</h3><pre>User (Maker) → REST API → Start Workflow<br>                        ↓<br>                 MakerCheckerWorkflow<br>                        ↓ waits for signal<br>          User (Checker) → Approve/Reject → Signal Workflow<br>                        ↓<br>          Workflow triggers Activities → Updates DB / Executes Transaction</pre><h3>Workflow Design (Java)</h3><h3>Workflow Interface</h3><pre>@WorkflowInterface<br>public interface MakerCheckerWorkflow {</pre><pre>    @WorkflowMethod<br>    String start(MCRequest request);</pre><pre>    @SignalMethod<br>    void approve(ApprovalRequest approvalRequest);</pre><pre>    @SignalMethod<br>    void reject(ApprovalRequest approvalRequest);<br>}</pre><h3>Workflow Implementation</h3><pre>public class MakerCheckerWorkflowImpl implements MakerCheckerWorkflow {</pre><pre>    private final MakerCheckerActivities activities =<br>            Workflow.newActivityStub(MakerCheckerActivities.class,<br>                ActivityOptions.newBuilder()<br>                               .setStartToCloseTimeout(Duration.ofMinutes(2))<br>                               .build());</pre><pre>    private boolean isApproved = false;<br>    private boolean isRejected = false;<br>    private ApprovalRequest approvalRequest;</pre><pre>    @Override<br>    public String start(MCRequest request) {</pre><pre>        // Save request initially<br>        activities.createMakerRequest(request);</pre><pre>        // Wait for checker action<br>        Workflow.await(() -&gt; isApproved || isRejected);</pre><pre>        if (isRejected) {<br>            activities.handleRejection(request, approvalRequest);<br>            return &quot;REJECTED&quot;;<br>        }</pre><pre>        // Execute on approval<br>        activities.processApprovedRequest(request, approvalRequest);<br>        return &quot;APPROVED&quot;;<br>    }</pre><pre>    @Override<br>    public void approve(ApprovalRequest approvalRequest) {<br>        this.approvalRequest = approvalRequest;<br>        this.isApproved = true;<br>    }</pre><pre>    @Override<br>    public void reject(ApprovalRequest approvalRequest) {<br>        this.approvalRequest = approvalRequest;<br>        this.isRejected = true;<br>    }<br>}</pre><h3>Activities Implementation</h3><pre>public class MakerCheckerActivitiesImpl implements MakerCheckerActivities {</pre><pre>    @Override<br>    public void createMakerRequest(MCRequest request) {<br>        // Save request in DB with PENDING status<br>    }</pre><pre>    @Override<br>    public void processApprovedRequest(MCRequest request, ApprovalRequest approvalRequest) {<br>        // Execute business operations<br>        // Update DB status to APPROVED<br>    }</pre><pre>    @Override<br>    public void handleRejection(MCRequest request, ApprovalRequest approvalRequest) {<br>        // Update status to REJECTED<br>        // Trigger notifications<br>    }<br>}</pre><h3>Starting Workflows from Spring Boot</h3><h3>Maker — Start a Workflow</h3><pre>public String initiateWorkflow(MCRequest request) {</pre><pre>    WorkflowOptions options = WorkflowOptions.newBuilder()<br>            .setWorkflowId(&quot;MC-&quot; + request.getRequestId())<br>            .setTaskQueue(&quot;MC_QUEUE&quot;)<br>            .build();</pre><pre>    MakerCheckerWorkflow workflow = client.newWorkflowStub(<br>            MakerCheckerWorkflow.class, options);</pre><pre>    WorkflowClient.start(workflow::start, request);<br>    return &quot;Workflow started&quot;;<br>}</pre><h3>Checker — Approve via Signal</h3><pre>public String approveRequest(String workflowId, ApprovalRequest approvalRequest) {</pre><pre>    MakerCheckerWorkflow workflow = client.newWorkflowStub(<br>            MakerCheckerWorkflow.class, workflowId);</pre><pre>    workflow.approve(approvalRequest);<br>    return &quot;Approval signal sent&quot;;<br>}</pre><h3>Use Cases Implemented</h3><p>Using the Temporal-based maker–checker engine, we automated approvals for:</p><ul><li><strong>Add or Remove User</strong></li><li><strong>Fund Transfers (NEFT/RTGS/IMPS)</strong></li><li><strong>Beneficiary Addition/Deletion</strong></li></ul><p>Each module uses the same workflow engine with unique workflow IDs.</p><h3>Benefits of Temporal-Based Maker–Checker</h3><h3>1. Zero Lost Approvals</h3><p>Durability ensures no state is lost — even after server restarts.</p><h3>2. No Cron Jobs or Manual Polling</h3><p>Checker actions are received via workflow <strong>signals</strong>.</p><h3>3. Complete Audit Trail</h3><p>Workflow history shows every step for compliance.</p><h3>4. Modular and Reusable</h3><p>New transaction types can plug into the same workflow.</p><h3>5. Naturally Resilient</h3><p>Retries, timers, and compensations come out of the box.</p><h3>Challenges &amp; Solutions</h3><h3>1. Long Approval Wait Times</h3><p>Temporal’s signal-based waiting solved this without threads or schedulers.</p><h3>2. Mapping Legacy Flows</h3><p>We separated domain operations into <strong>activities</strong>, keeping the workflow clean.</p><h3>3. Scaling Workload</h3><p>Dedicated task queues helped scale different transaction modules independently.</p><h3>Final Thoughts</h3><p>Temporal Java SDK transformed how we designed the maker–checker system. Instead of building custom state machines, cron jobs, and retry logic, Temporal provided a <strong>durable, scalable, event-driven workflow engine</strong>.</p><p>If you’re building anything involving:</p><ul><li>Human approvals</li><li>Multi-step transactions</li><li>Compliance flows</li><li>Payment gateways</li><li>Long-running business processes</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ec49c3c3c4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>