This commit is contained in:
2026-02-19 16:39:31 +07:00
parent 4e32a958ea
commit e7c5e5f77f

View File

@@ -53,7 +53,7 @@ struct msgPayload_v1
encoding::String # "none | json | base64 | arrow-ipc"
size::Integer # data size in bytes e.g. 15433
data::Any # payload data in case of direct transport or a URL in case of link
metadata::Dict{String, Any} # Dict("checksum=> "sha256_hash", ...) This metadata is for this payload
metadata::Dict{String, Any} # Dict("checksum" => "sha256_hash", ...) This metadata is for this payload
end
# constructor
@@ -530,7 +530,7 @@ end
This function processes incoming NATS messages, handling both direct transport
(base64 decoded payloads) and link transport (URL-based payloads).
It deserializes the data based on the transport type and returns the result.
A HTTP file server is required along with its upload function.
A HTTP file server is required along with its download function.
Arguments:
- `msg::NATS.Msg` - NATS message to process
@@ -542,14 +542,14 @@ Keyword Arguments:
- `max_delay::Int` - Maximum delay for exponential backoff in ms (default: 5000)
Return:
- `AbstractArray{Tuple{String, Any}}` - List of (dataname, data) tuples
- `AbstractArray{Tuple{String, Any, String}}` - List of (dataname, data, type) tuples
# Example
```julia
# Receive and process message
msg = nats_message # NATS message
payloads = smartreceive(msg, fileserverDownloadHandler, max_retries, base_delay, max_delay)
# payloads = [("dataname1", data1), ("dataname2", data2), ...]
payloads = smartreceive(msg; fileserverDownloadHandler=_fetch_with_backoff, max_retries=5, base_delay=100, max_delay=5000)
# payloads = [("dataname1", data1, "type1"), ("dataname2", data2, "type2"), ...]
```
"""
function smartreceive(