update
This commit is contained in:
@@ -118,43 +118,35 @@ env = smartreceive(msg; fileserver_download_handler=_fetch_with_backoff, max_ret
|
||||
The Julia implementation follows the Claim-Check pattern:
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph Sender["Julia Application (Sender)"]
|
||||
App[App Code]
|
||||
NATSBridge[NATSBridge]
|
||||
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
|
||||
flowchart TD
|
||||
A[SmartSend Function] --> B{Is payload size < 1MB?}
|
||||
B -->|Yes | C[Direct Path<br/><small>< 1MB</small>]
|
||||
B -->|No | D[Link Path<br/><small>>= 1MB</small>]
|
||||
|
||||
NATS --> NATS_Client_Recv
|
||||
NATS_Client_Recv --> NATSBridge_Recv
|
||||
NATSBridge_Recv --> App_Recv
|
||||
|
||||
NATSBridge -.->|HTTP POST upload| FileServer
|
||||
FileServer -.->|HTTP GET download| NATSBridge_Recv
|
||||
|
||||
style App fill:#e8f5e9
|
||||
style App_Recv fill:#e8f5e9
|
||||
style NATSBridge fill:#c5e1a5
|
||||
style NATSBridge_Recv fill:#c5e1a5
|
||||
style NATS fill:#fff3e0
|
||||
style FileServer fill:#f3e5f5
|
||||
C --> C1[Serialize to Buffer]
|
||||
C1 --> C2[Base64 encode]
|
||||
C2 --> C3[Publish to NATS]
|
||||
|
||||
D --> D1[Serialize to Buffer]
|
||||
D1 --> D2[Upload to HTTP Server]
|
||||
D2 --> D3[Publish to NATS with URL]
|
||||
|
||||
style A fill:#e1f5ff,stroke:#0066cc,stroke-width:2px
|
||||
style B fill:#fff4e1,stroke:#cc6600,stroke-width:2px
|
||||
style C fill:#e8f5e9,stroke:#008000,stroke-width:2px
|
||||
style D fill:#e8f5e9,stroke:#008000,stroke-width:2px
|
||||
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
|
||||
|
||||
The `smartsend` function now returns a tuple containing both the envelope object and the JSON string representation:
|
||||
|
||||
Reference in New Issue
Block a user