fix output annotation

This commit is contained in:
2026-03-04 11:58:19 +07:00
parent 95fe697501
commit e5f4793370
8 changed files with 27 additions and 18 deletions

View File

@@ -388,7 +388,7 @@ Each payload can have a different type, enabling mixed-content messages (e.g., c
- `sender_id::String = string(uuid4())` - Sender ID (auto-generated UUID if not provided)
# Return:
- A tuple `(env, env_json_str)` where:
- `::Tuple{msg_envelope_v1, String}` - A tuple containing:
- `env::msg_envelope_v1` - The envelope object containing all metadata and payloads
- `env_json_str::String` - JSON string representation of the envelope for publishing
@@ -447,7 +447,7 @@ function smartsend(
NATS_connection::Union{NATS.Connection, Nothing} = nothing, # a provided connection saves establishing connection overhead.
msg_id::String = string(uuid4()), # Message ID
sender_id::String = string(uuid4()) # Sender ID
) where {T1<:Any}
)::Tuple{msg_envelope_v1, String} where {T1<:Any}
# Log start of send operation
log_trace(correlation_id, "Starting smartsend for subject: $subject")
@@ -754,14 +754,14 @@ A HTTP file server is required along with its download function.
- `max_delay::Int = 5000` - Maximum delay for exponential backoff in ms
# Return:
- JSON object of envelope with list of (dataname, data, data_type) tuples in payloads field
- `::JSON.Object{String, Any}` - key-value structure resemble msg_envelope_v1
# Example
```jldoctest
# Receive and process message
msg = nats_message # NATS message
payloads = smartreceive(msg; fileserver_download_handler=_fetch_with_backoff, max_retries=5, base_delay=100, max_delay=5000)
# payloads = [("dataname1", data1, "type1"), ("dataname2", data2, "type2"), ...]
env = smartreceive(msg; fileserver_download_handler=_fetch_with_backoff, max_retries=5, base_delay=100, max_delay=5000)
# env["payloads"] = [("dataname1", data1, "type1"), ("dataname2", data2, "type2"), ...]
```
"""
function smartreceive(
@@ -770,7 +770,7 @@ function smartreceive(
max_retries::Int = 5,
base_delay::Int = 100,
max_delay::Int = 5000
)
)::JSON.Object{String, Any}
# Parse the JSON envelope
env_json_obj = JSON.parse(String(msg.payload))
log_trace(env_json_obj["correlation_id"], "Processing received message") # Log message processing start
@@ -818,7 +818,7 @@ function smartreceive(
end
end
env_json_obj["payloads"] = payloads_list
return env_json_obj # JSON object of envelope with list of (dataname, data, data_type) tuples in payloads field
return env_json_obj # key-value structure resemble msg_envelope_v1
end