Segment Routing Architecture

One clientSegment flag — set at intake, immutable for the case lifetime — drives every branching decision in the platform.


Table of Contents

  1. 12.1 Routing Decision Map
  2. 12.2 The WorkflowConfig Pattern
    1. Why This Matters
  3. 12.3 What Segment Controls
  4. 12.4 Immutability of Segment

12.1 Routing Decision Map

%%{init: {'theme': 'base'}}%%
flowchart LR
    classDef entry      fill:#457b9d,stroke:#1d3557,color:#ffffff,font-weight:bold
    classDef segSmall   fill:#2d6a4f,stroke:#1b4332,color:#ffffff
    classDef segMedium  fill:#1d3557,stroke:#a8dadc,color:#ffffff
    classDef segEnt     fill:#5c4a8a,stroke:#c77dff,color:#ffffff,font-weight:bold

    Input(["▶  OnboardingRequest\nreceived"]):::entry

    SegmentSet["clientSegment set at intake\nImmutable for case lifetime\nSource: operator or digital channel"]:::entry

    SmallSeg["SMALL\nPhases: 1 · 4 · 5 · 6 · 7 · 8\nSkips Order Approval + Compliance Gate\nProducts: up to 10\nAnchita Digital Banking Portal (Standard tier)"]:::segSmall

    MediumSeg["MEDIUM\nPhases: 1 · 3 · 4 · 5 · 6 · 7 · 8\nCompliance Gate active\nProducts: up to 14\nAnchita Digital Banking Portal (Standard tier)"]:::segMedium

    EnterpriseSeg["ENTERPRISE\nAll 8 phases\nFull Compliance Gate — child workflow\nProducts: full catalog\nAnchita Digital Banking Portal (Enterprise tier)\nInstant Payments · Identifier workflow · Corp hierarchy"]:::segEnt

    Input --> SegmentSet
    SegmentSet --> SmallSeg
    SegmentSet --> MediumSeg
    SegmentSet --> EnterpriseSeg
Segment key     🟩 SMALL — 10 products · 6 phases  ·  🟦 MEDIUM — 14 products · 7 phases  ·  🟪 ENTERPRISE — 23 products · 8 phases

12.2 The WorkflowConfig Pattern

Rather than branching the workflow code with scattered if (segment == ENTERPRISE) checks, each segment is expressed as a WorkflowConfig record computed once at workflow start:

public record WorkflowConfig(
    boolean requiresOrderApproval,
    boolean requiresComplianceGate,
    boolean complianceGateIsChildWorkflow,  // Enterprise: child wf; Medium: inline
    String portalTier,                      // "STANDARD" | "ENTERPRISE" — controls feature gating in Anchita Digital Banking Portal
    boolean wireRequiresOpsApproval,        // Enterprise only
    boolean corporateHierarchyEnabled,      // Enterprise only
    boolean rtpEligible,                    // Enterprise only
    Set<String> availableProductCodes,
    int maxParallelProducts
) {
    public static WorkflowConfig forSegment(ClientSegment segment) {
        return switch (segment) {
            case SMALL      -> new WorkflowConfig(
                false, false, false,
                "STANDARD",
                false, false, false,
                SMALL_PRODUCTS, 3
            );
            case MEDIUM     -> new WorkflowConfig(
                false, true, false,
                "STANDARD",
                false, false, false,
                MEDIUM_PRODUCTS, 14
            );
            case ENTERPRISE -> new WorkflowConfig(
                true, true, true,
                "ENTERPRISE",
                true, true, true,
                ENTERPRISE_PRODUCTS, 23
            );
        };
    }
}

Why This Matters

Testability: Each segment’s full behaviour is declared in one place. A unit test for SMALL verifies all 8 boolean flags and the product set at once.

Readability: The workflow code reads if (config.requiresComplianceGate()) — not if (segment == MEDIUM || segment == ENTERPRISE). The business rule is named, not inlined.

Extensibility: Adding a new segment (hypothetically: MICRO, GLOBAL) means adding one new case branch in forSegment() — no workflow code needs to change.


12.3 What Segment Controls

Dimension SMALL MEDIUM ENTERPRISE
Phases 1, 4, 5, 6, 7, 8 1, 3, 4, 5, 6, 7, 8 1, 2, 3, 4, 5, 6, 7, 8
Order Approval Gate
Compliance Gate ✓ (inline) ✓ (child workflow)
Products available 10 14 23
Digital platform Anchita Digital Banking Portal (Standard tier) Anchita Digital Banking Portal (Standard tier) Anchita Digital Banking Portal (Enterprise tier)
Wire Identifier Standard Standard Ops Center review
Corporate hierarchy
RTP / FedNow / SWIFT
Max parallel products 3 14 23

12.4 Immutability of Segment

The clientSegment is written to the cases table at intake and never updated. If a client grows from SMALL to MEDIUM, they go through a new onboarding case — not a modification of an existing case. This ensures:

  • The audit trail unambiguously records which segment’s rules applied at the time of onboarding
  • Workflow replay (Temporal’s history mechanism) always produces the same result for a given case
  • Compliance records (BSA attestation, document review) are always tied to the segment that was in effect

↑ Back to top

Anchita Platform — Fictional Reference Architecture for Cloud-Native Institutional Banking