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:
|
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)"]
|
C --> C1[Serialize to Buffer]
|
||||||
App_Recv[App Code]
|
C1 --> C2[Base64 encode]
|
||||||
NATSBridge_Recv[NATSBridge]
|
C2 --> C3[Publish to NATS]
|
||||||
NATS_Client_Recv[<b>NATS.jl</b>]
|
|
||||||
end
|
|
||||||
|
|
||||||
subgraph Infrastructure["Infrastructure"]
|
D --> D1[Serialize to Buffer]
|
||||||
NATS[<b>NATS Server</b><br/>Message Broker]
|
D1 --> D2[Upload to HTTP Server]
|
||||||
FileServer[<b>HTTP File Server</b><br/>Upload/Download]
|
D2 --> D3[Publish to NATS with URL]
|
||||||
end
|
|
||||||
|
|
||||||
App --> NATSBridge
|
style A fill:#e1f5ff,stroke:#0066cc,stroke-width:2px
|
||||||
NATSBridge --> NATS_Client
|
style B fill:#fff4e1,stroke:#cc6600,stroke-width:2px
|
||||||
NATS_Client --> NATS
|
style C fill:#e8f5e9,stroke:#008000,stroke-width:2px
|
||||||
|
style D fill:#e8f5e9,stroke:#008000,stroke-width:2px
|
||||||
NATS --> NATS_Client_Recv
|
style C1 fill:#f5f5f5,stroke:#666,stroke-width:1px
|
||||||
NATS_Client_Recv --> NATSBridge_Recv
|
style C2 fill:#f5f5f5,stroke:#666,stroke-width:1px
|
||||||
NATSBridge_Recv --> App_Recv
|
style C3 fill:#f5f5f5,stroke:#666,stroke-width:1px
|
||||||
|
style D1 fill:#f5f5f5,stroke:#666,stroke-width:1px
|
||||||
NATSBridge -.->|HTTP POST upload| FileServer
|
style D2 fill:#f5f5f5,stroke:#666,stroke-width:1px
|
||||||
FileServer -.->|HTTP GET download| NATSBridge_Recv
|
style D3 fill:#f5f5f5,stroke:#666,stroke-width:1px
|
||||||
|
|
||||||
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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**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:
|
||||||
|
|||||||
Reference in New Issue
Block a user