# playtikaoss/json-reactive architecture

> Architecture diagram of the GitHub repository playtikaoss/json-reactive, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/playtikaoss/json-reactive
- Repository: https://github.com/playtikaoss/json-reactive

## Overview

##### Component Relationships

**[Reactor/RxJava2 Consumers] → [ReactorObjectReader/Rx2ObjectReader]**
- ↓
**[NonBlockingObjectReader] ← [Jackson NonBlocking Parser]**
- ↓
**[Tokenizer] → [ByteBuffer Processing]**

##### Special Elements

a) Data Flow Indicators:
- ByteBuffer input flow
- Reactive stream output (Flux/Flowable)
- Async boundaries

b) Key Interfaces:
- JsonFactory integration points
- ObjectMapper reader integration

##### Implementation Details to Highlight

- Non-blocking nature of the parser
- Transformation from raw JSON to POJO objects
- Where reactive backpressure is handled

##### Notes Section

Technical notes about:
- Thread model
- Backpressure handling
- Memory usage characteristics

- The clean separation between the reactive implementations (Reactor/RxJava2)
- The shared core non-blocking implementation
- The integration with Jackson's parser
- The reactive streaming nature of the data flow

Keep the abstraction level focused on the architectural components while showing the key technical decisions that enable non-blocking JSON parsing with reactive streams support.

##### The integration with Jackson's ecosystem

Remember to maintain a balance between showing the high-level architecture and the important technical details that make this library unique in its non-blocking, reactive approach to JSON parsing.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef api fill:#2196F3,stroke:#1565C0,color:white
    classDef core fill:#4CAF50,stroke:#2E7D32,color:white
    classDef jackson fill:#FFC107,stroke:#FFA000,color:black
    classDef external fill:#9E9E9E,stroke:#616161,color:white

    %% Integration Layer
    subgraph Integration
        ReactorImpl["Reactor Implementation"]:::api
        RxImpl["RxJava2 Implementation"]:::api
    end

    %% Core Layer
    subgraph Core
        NonBlockingReader["NonBlockingObjectReader"]:::core
        TokenizerComp["Tokenizer"]:::core
    end

    %% Jackson Layer
    subgraph Jackson
        JacksonParser["NonBlockingJsonParser"]:::jackson
        JacksonFactory["JsonFactory"]:::jackson
    end

    %% Foundation Layer
    subgraph Foundation
        ByteBuffer["ByteBuffer Input Sources"]:::external
    end

    %% Relationships
    ReactorImpl --> NonBlockingReader
    RxImpl --> NonBlockingReader
    NonBlockingReader --> TokenizerComp
    TokenizerComp --> JacksonParser
    JacksonParser --> JacksonFactory
    ByteBuffer --> TokenizerComp

    %% Click Events
    click ReactorImpl "https://github.com/PlaytikaOSS/json-reactive/blob/develop/json-reactor/src/main/java/reactivejson/ReactorObjectReader.java"
    click RxImpl "https://github.com/PlaytikaOSS/json-reactive/blob/develop/json-rx2/src/main/java/reactivejson/Rx2ObjectReader.java"
    click NonBlockingReader "https://github.com/PlaytikaOSS/json-reactive/blob/develop/json-nonblocking/src/main/java/reactivejson/NonBlockingObjectReader.java"
    click TokenizerComp "https://github.com/PlaytikaOSS/json-reactive/blob/develop/json-nonblocking/src/main/java/reactivejson/Tokenizer.java"
    click JacksonParser "https://github.com/PlaytikaOSS/json-reactive/blob/develop/json-nonblocking/src/main/java/com/fasterxml/jackson/core/async_/NonBlockingJsonParser.java"
    click JacksonFactory "https://github.com/PlaytikaOSS/json-reactive/blob/develop/json-nonblocking/src/main/java/com/fasterxml/jackson/core/async_/JsonFactory.java"

    %% Legend
    subgraph Legend
        API["API Components"]:::api
        CoreComp["Core Components"]:::core
        JacksonComp["Jackson Components"]:::jackson
        ExtComp["External Components"]:::external
    end

    %% Notes
    subgraph Notes
        ThreadModel["Thread Model: Non-blocking"]
        Backpressure["Backpressure: Handled by Reactive Streams"]
        Memory["Memory: Efficient ByteBuffer processing"]
    end
```
