This commit is contained in:
2026-03-05 07:28:28 +07:00
parent 206467e1fa
commit e85eba4cea

View File

@@ -118,43 +118,35 @@ env = smartreceive(msg; fileserver_download_handler=_fetch_with_backoff, max_ret
The Julia implementation follows the Claim-Check pattern: The Julia implementation follows the Claim-Check pattern:
```mermaid ```mermaid
flowchart TB flowchart TD
subgraph Sender["Julia Application (Sender)"] A[SmartSend Function] --> B{Is payload size < 1MB?}
App[App Code] B -->|Yes | C[Direct Path<br/><small>< 1MB</small>]
NATSBridge[NATSBridge] B -->|No | D[Link Path<br/><small>>= 1MB</small>]
NATS_Client[<b>NATS.jl</b>]
end
subgraph Receiver["Julia Application (Receiver)"]
App_Recv[App Code]
NATSBridge_Recv[NATSBridge]
NATS_Client_Recv[<b>NATS.jl</b>]
end
subgraph Infrastructure["Infrastructure"]
NATS[<b>NATS Server</b><br/>Message Broker]
FileServer[<b>HTTP File Server</b><br/>Upload/Download]
end
App --> NATSBridge
NATSBridge --> NATS_Client
NATS_Client --> NATS
NATS --> NATS_Client_Recv C --> C1[Serialize to Buffer]
NATS_Client_Recv --> NATSBridge_Recv C1 --> C2[Base64 encode]
NATSBridge_Recv --> App_Recv C2 --> C3[Publish to NATS]
NATSBridge -.->|HTTP POST upload| FileServer D --> D1[Serialize to Buffer]
FileServer -.->|HTTP GET download| NATSBridge_Recv D1 --> D2[Upload to HTTP Server]
D2 --> D3[Publish to NATS with URL]
style App fill:#e8f5e9
style App_Recv fill:#e8f5e9 style A fill:#e1f5ff,stroke:#0066cc,stroke-width:2px
style NATSBridge fill:#c5e1a5 style B fill:#fff4e1,stroke:#cc6600,stroke-width:2px
style NATSBridge_Recv fill:#c5e1a5 style C fill:#e8f5e9,stroke:#008000,stroke-width:2px
style NATS fill:#fff3e0 style D fill:#e8f5e9,stroke:#008000,stroke-width:2px
style FileServer fill:#f3e5f5 style C1 fill:#f5f5f5,stroke:#666,stroke-width:1px
style C2 fill:#f5f5f5,stroke:#666,stroke-width:1px
style C3 fill:#f5f5f5,stroke:#666,stroke-width:1px
style D1 fill:#f5f5f5,stroke:#666,stroke-width:1px
style D2 fill:#f5f5f5,stroke:#666,stroke-width:1px
style D3 fill:#f5f5f5,stroke:#666,stroke-width:1px
``` ```
**Claim-Check Pattern Overview:**
- **Direct Path** (< 1MB): Payload is serialized, Base64-encoded, and published directly to NATS
- **Link Path** (≥ 1MB): Payload is serialized, uploaded to an HTTP file server, and only the URL is published to NATS (claim-check pattern)
## smartsend Return Value ## smartsend Return Value
The `smartsend` function now returns a tuple containing both the envelope object and the JSON string representation: The `smartsend` function now returns a tuple containing both the envelope object and the JSON string representation: