Use Cases

Real-World Applications of the Panglot Platform

Overview

The Panglot platform supports a wide range of distributed system scenarios. This section demonstrates practical use cases across different domains, showcasing how the hybrid architecture enables complex workflows with reliability and performance.

E-Commerce Order Processing

A complete customer journey from browsing products to order fulfillment, demonstrating synchronous REST APIs, asynchronous event processing, and saga orchestration.

Scenario Flow

sequenceDiagram
    participant C as Customer
    participant GW as API Gateway
    participant BFF as BFF-Web
    participant O as Orders Service
    participant P as Payments Service
    participant I as Inventory Service
    participant K as Event Bus

    C->>GW: POST /api/v1/orders
    GW->>GW: Validate JWT
    GW->>BFF: Forward request
    BFF->>O: CreateOrder(gRPC)
    
    O->>O: Validate order
    O->>O: Save to DB
    O->>K: Publish OrderCreated event
    O-->>BFF: OrderID, Status=PENDING
    BFF-->>C: 201 Created

    Note over K,I: Asynchronous Processing
    
    K->>P: OrderCreated event
    P->>P: Authorize payment
    P->>K: Publish PaymentAuthorized
    
    K->>I: PaymentAuthorized event
    I->>I: Reserve inventory
    I->>K: Publish InventoryReserved
    
    K->>P: InventoryReserved event
    P->>P: Capture payment
    P->>K: Publish PaymentCaptured
    
    K->>O: PaymentCaptured event
    O->>O: Update status=CONFIRMED
    O->>K: Publish OrderConfirmed
                

Key Features Demonstrated

Payment Processing with Compensation

Handling payment failures and automatic compensation to maintain system consistency.

Compensation Flow

sequenceDiagram
    participant O as Orders Service
    participant P as Payments Service
    participant I as Inventory Service
    participant K as Event Bus

    Note over O,K: Happy Path
    O->>K: OrderCreated
    K->>P: Process payment
    P->>K: PaymentAuthorized
    K->>I: Reserve inventory
    I->>K: InventoryReservationFailed
    
    Note over O,K: Compensation Flow
    K->>P: InventoryReservationFailed
    P->>P: Void authorization
    P->>K: PaymentVoided
    
    K->>O: PaymentVoided
    O->>O: Update status=FAILED
    O->>K: OrderCancelled
                

⚠️ Eventual Consistency

The system maintains eventual consistency through compensating transactions. The order may temporarily appear in an intermediate state before reaching final status.

Multi-Channel API Access

Different client types accessing the same backend services through optimized interfaces.

graph LR
    subgraph Clients
        WEB[Web Browser]
        MOB[Mobile App]
        PART[Partner System]
    end

    subgraph Edge
        REST[REST API]
        GQL[GraphQL API]
    end

    subgraph Services
        ORD[Orders]
        PAY[Payments]
        INV[Inventory]
    end

    WEB -->|REST| REST
    MOB -->|GraphQL| GQL
    PART -->|REST| REST

    REST -->|gRPC| ORD
    REST -->|gRPC| PAY
    REST -->|gRPC| INV

    GQL -->|gRPC| ORD
    GQL -->|gRPC| PAY
    GQL -->|gRPC| INV

    style WEB fill:#e3f2fd
    style MOB fill:#e3f2fd
    style PART fill:#e3f2fd
    style REST fill:#fff3e0
    style GQL fill:#fff3e0
    style ORD fill:#f3e5f5
    style PAY fill:#f3e5f5
    style INV fill:#f3e5f5
                

Channel Characteristics

Channel Protocol Use Case Optimization
Web Browser REST Standard CRUD operations HTTP caching, pagination
Mobile App GraphQL Flexible data fetching Query batching, field selection
Partner API REST B2B integration Rate limiting, API keys

Real-Time Inventory Management

Event-driven inventory updates across multiple warehouses with real-time stock tracking.

graph TB
    subgraph Sources["📦 Inventory Sources"]
        W1[Warehouse A]
        W2[Warehouse B]
        W3[Warehouse C]
        POS[Point of Sale]
    end

    subgraph Processing["⚙️ Event Processing"]
        INV[Inventory Service]
        AGG[Event Aggregator]
    end

    subgraph Consumers["📊 Consumers"]
        WEB[Website Stock Display]
        ALERT[Low Stock Alerts]
        ANALYTICS[Analytics Dashboard]
        REORDER[Auto-Reorder System]
    end

    W1 -->|StockUpdated| INV
    W2 -->|StockUpdated| INV
    W3 -->|StockUpdated| INV
    POS -->|ItemSold| INV

    INV -->|Events| AGG

    AGG -->|Real-time Updates| WEB
    AGG -->|Threshold Alerts| ALERT
    AGG -->|Metrics| ANALYTICS
    AGG -->|Trigger| REORDER

    style Sources fill:#e8f5e9
    style Processing fill:#f3e5f5
    style Consumers fill:#e3f2fd
                

Event Types

Microservices Health Monitoring

Comprehensive observability with distributed tracing and real-time health checks.

graph TB
    subgraph Services["🔧 Microservices"]
        S1[Orders]
        S2[Payments]
        S3[Inventory]
    end

    subgraph Mesh["🔗 Service Mesh"]
        PROXY1[Sidecar Proxy]
        PROXY2[Sidecar Proxy]
        PROXY3[Sidecar Proxy]
    end

    subgraph Observability["📊 Observability Stack"]
        OTEL[OpenTelemetry
Collector] JAEGER[Jaeger
Tracing] PROM[Prometheus
Metrics] LOKI[Loki
Logs] GRAFANA[Grafana
Dashboard] end S1 -.->|Traces| PROXY1 S2 -.->|Traces| PROXY2 S3 -.->|Traces| PROXY3 PROXY1 -->|Telemetry| OTEL PROXY2 -->|Telemetry| OTEL PROXY3 -->|Telemetry| OTEL OTEL -->|Traces| JAEGER OTEL -->|Metrics| PROM OTEL -->|Logs| LOKI JAEGER --> GRAFANA PROM --> GRAFANA LOKI --> GRAFANA style Services fill:#f3e5f5 style Mesh fill:#fff3e0 style Observability fill:#e3f2fd

✅ Full Stack Observability

  • Distributed Tracing: Track requests across service boundaries
  • Metrics: Real-time performance indicators and SLIs
  • Structured Logs: Correlated logs with trace IDs
  • Service Mesh Insights: Network-level metrics and policies

Circuit Breaker and Resilience

Automatic failure detection and recovery without cascading failures.

stateDiagram-v2
    [*] --> Closed: Initial State
    
    Closed --> Open: Failure threshold reached
    Closed --> Closed: Successful requests
    
    Open --> HalfOpen: Timeout elapsed
    Open --> Open: Reject all requests
    
    HalfOpen --> Closed: Test request succeeds
    HalfOpen --> Open: Test request fails
    HalfOpen --> HalfOpen: Limited test requests

    note right of Closed
        Normal operation
        All requests pass through
    end note

    note right of Open
        Circuit tripped
        Fast-fail responses
    end note

    note right of HalfOpen
        Testing recovery
        Limited requests allowed
    end note
                

Resilience Patterns

Pattern Purpose Implementation
Circuit Breaker Prevent cascade failures Service Mesh automatic detection
Retry with Backoff Handle transient failures Exponential backoff, jitter
Timeout Prevent resource exhaustion gRPC deadlines, context propagation
Bulkhead Isolate resource pools Connection pool limits

Quantum Computing Integration

Example of integrating quantum processing units through the platform architecture.

sequenceDiagram
    participant C as Client
    participant BFF as BFF
    participant QS as Quantum Service
    participant QPU as Quantum Processor
    participant K as Event Bus

    C->>BFF: POST /quantum/optimize
    BFF->>QS: SubmitQuantumJob(gRPC)
    QS->>QS: Prepare circuit
    QS->>K: Publish JobSubmitted
    QS-->>BFF: JobID
    BFF-->>C: 202 Accepted

    Note over QS,QPU: Async Execution
    QS->>QPU: Execute quantum circuit
    QPU-->>QS: Quantum result
    QS->>QS: Classical post-processing
    QS->>K: Publish JobCompleted

    Note over C,K: Result Retrieval
    C->>BFF: GET /quantum/jobs/{id}
    BFF->>QS: GetJobResult(gRPC)
    QS-->>BFF: Result data
    BFF-->>C: 200 OK with results
                

Hybrid Quantum-Classical Workflow

The architecture supports quantum computing by exposing QPUs through standard REST/gRPC interfaces while handling the asynchronous nature of quantum computations through the event-driven layer.

Use Case Summary

These use cases demonstrate how the Panglot platform's hybrid architecture addresses real-world distributed system challenges: