# zalando/riptide architecture

> Architecture diagram of the GitHub repository zalando/riptide, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zalando/riptide
- Repository: https://github.com/zalando/riptide

## Overview

##### Main Components Overview
The system should be represented as a layered architecture with the following main components:

a. Core Layer:
- HTTP Client Core (riptide-core)
- Request/Response Handling
- Plugin System
- Thread Pool Management

b. Integration Layer:
- Spring Boot Integration (riptide-spring-boot-starter)
- Authentication (riptide-auth)
- Monitoring/Metrics (riptide-micrometer, riptide-opentelemetry, riptide-opentracing)
- Resilience Features (riptide-failsafe, riptide-faults)

c. Extension Layer:
- Streaming Support (riptide-stream)
- Problem Handling (riptide-problem)
- SOAP Support (riptide-soap)
- Compression (riptide-compression)

##### Component Relationships

a. Core Flow:
**Client Application -> Riptide Core -> HTTP Client (Apache/OkHttp) -> External Services**

b. Plugin Chain:
**Request -> Authorization -> Failsafe -> Metrics -> Tracing -> Core Processing**

##### Detailed Elements

Specific components with appropriate symbols:

a. Infrastructure Components:
- Thread Pools (bounded/unbounded queues)
- Connection Pools
- Request Factory

b. Processing Components:
- Message Converters
- Route Handlers
- Response Dispatchers
- Plugin Chain

c. Resilience Components:
- Circuit Breaker
- Retry Mechanism
- Backup Requests
- Timeout Handling

##### Key Interactions to Highlight

a. Request Flow:
**Client -> Thread Pool -> Plugin Chain -> HTTP Client -> External Service**

b. Response Flow:
**External Service -> HTTP Client -> Response Router -> Callback Handler**

c. Resilience Pattern:
**Request -> Failsafe Plugin -> [Retry/Circuit Breaker] -> Actual Request**

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        APP[Client Application]
    end

    subgraph Core["Core Layer"]
        CORE[HTTP Client Core]:::core
        HTTPC[HTTP Client Implementation]:::core
        PLUGIN[Plugin System]:::core
        THREAD[Thread Pool Management]:::core
        
        CORE --> HTTPC
        CORE --> PLUGIN
        CORE --> THREAD
    end

    subgraph Integration["Integration Layer"]
        SPRING[Spring Boot Integration]:::integration
        AUTH[Authentication]:::integration
        METRICS[Monitoring/Metrics]:::monitoring
        RESIL[Resilience Features]:::resilience
        
        subgraph Monitoring
            MICRO[Micrometer]:::monitoring
            OTELE[OpenTelemetry]:::monitoring
            OTRAC[OpenTracing]:::monitoring
        end
        
        subgraph Resilience
            FAILS[Failsafe]:::resilience
            FAULT[Fault Handling]:::resilience
            CHAOS[Chaos Testing]:::resilience
        end
    end

    subgraph Extensions["Extension Layer"]
        STREAM[Streaming Support]:::extension
        PROB[Problem Handling]:::extension
        SOAP[SOAP Support]:::extension
        COMP[Compression]:::extension
    end

    subgraph Utilities["Utility Layer"]
        CONC[Concurrent Operations]:::utility
        CAPT[Capture]:::utility
        COMPAT[Compatibility]:::utility
        IDEMPO[Idempotency]:::utility
        LOG[Logging]:::utility
    end

    APP --> CORE
    CORE --> PLUGIN
    PLUGIN --> |Request Chain| AUTH
    AUTH --> FAILS
    FAILS --> METRICS
    METRICS --> EXTERNAL[External Services]

    click CORE "https://github.com/zalando/riptide/tree/main/riptide-core"
    click HTTPC "https://github.com/zalando/riptide/tree/main/riptide-httpclient"
    click AUTH "https://github.com/zalando/riptide/tree/main/riptide-auth"
    click MICRO "https://github.com/zalando/riptide/tree/main/riptide-micrometer"
    click OTELE "https://github.com/zalando/riptide/tree/main/riptide-opentelemetry"
    click OTRAC "https://github.com/zalando/riptide/tree/main/riptide-opentracing"
    click FAILS "https://github.com/zalando/riptide/tree/main/riptide-failsafe"
    click FAULT "https://github.com/zalando/riptide/tree/main/riptide-faults"
    click CHAOS "https://github.com/zalando/riptide/tree/main/riptide-chaos"
    click SPRING "https://github.com/zalando/riptide/tree/main/riptide-spring-boot-starter"
    click STREAM "https://github.com/zalando/riptide/tree/main/riptide-stream"
    click PROB "https://github.com/zalando/riptide/tree/main/riptide-problem"
    click SOAP "https://github.com/zalando/riptide/tree/main/riptide-soap"
    click COMP "https://github.com/zalando/riptide/tree/main/riptide-compression"
    click CONC "https://github.com/zalando/riptide/tree/main/riptide-concurrent"
    click CAPT "https://github.com/zalando/riptide/tree/main/riptide-capture"
    click COMPAT "https://github.com/zalando/riptide/tree/main/riptide-compatibility"
    click IDEMPO "https://github.com/zalando/riptide/tree/main/riptide-idempotency"
    click LOG "https://github.com/zalando/riptide/tree/main/riptide-logbook"

    classDef core fill:#003366,color:#FFFFFF
    classDef integration fill:#990033,color:#FFFFFF
    classDef monitoring fill:#CC6600,color:#FFFFFF
    classDef resilience fill:#4B0082,color:#FFFFFF
    classDef extension fill:#996600,color:#FFFFFF
    classDef utility fill:#000066,color:#FFFFFF

    subgraph Legend
        L1[Core Components]:::core
        L2[Integration Components]:::integration
        L3[Monitoring Components]:::monitoring
        L4[Resilience Components]:::resilience
        L5[Extension Components]:::extension
        L6[Utility Components]:::utility
    end
```
