This commit is contained in:
2026-02-23 21:54:50 +07:00
parent 99bf57b154
commit 7853e94d2e
21 changed files with 65 additions and 65 deletions

View File

@@ -386,9 +386,9 @@ Each payload can have a different type, enabling mixed-content messages (e.g., c
- `is_publish::Bool = true` - Whether to automatically publish the message to NATS
# Return:
- A tuple `(env, msg_json_str)` where:
- A tuple `(env, env_json_str)` where:
- `env::msgEnvelope_v1` - The envelope object containing all metadata and payloads
- `msg_json_str::String` - JSON string representation of the envelope for publishing
- `env_json_str::String` - JSON string representation of the envelope for publishing
# Example
```jldoctest
@@ -415,7 +415,7 @@ env, msg_json = smartsend("chat.subject", [
])
# Publish the JSON string directly using NATS request-reply pattern
# reply = NATS.request(nats_url, subject, msg_json_str; reply_to=reply_to_topic)
# reply = NATS.request(nats_url, subject, env_json_str; reply_to=reply_to_topic)
```
""" #[PENDING]
function smartsend(
@@ -432,7 +432,7 @@ function smartsend(
receiver_id::String = "",
reply_to::String = "",
reply_to_msg_id::String = "",
is_publish::Bool = true # some time the user want to get env and msg_json_str from this function without publishing the msg
is_publish::Bool = true # some time the user want to get env and env_json_str from this function without publishing the msg
) where {T1<:Any}
# Generate correlation ID if not provided
@@ -516,12 +516,12 @@ function smartsend(
metadata = Dict{String, Any}(),
)
msg_json_str = envelope_to_json(env) # Convert envelope to JSON
env_json_str = envelope_to_json(env) # Convert envelope to JSON
if is_publish
publish_message(nats_url, subject, msg_json_str, cid) # Publish message to NATS
publish_message(nats_url, subject, env_json_str, cid) # Publish message to NATS
end
return (env, msg_json_str)
return (env, env_json_str)
end