This commit is contained in:
2026-02-10 16:05:11 +07:00
parent 94fde6cea9
commit 5aab1d0c52
2 changed files with 8 additions and 8 deletions

View File

@@ -162,7 +162,7 @@ function smartsend(
subject::String, # smartreceive's subject subject::String, # smartreceive's subject
data::Any, data::Any,
type::String = "json"; type::String = "json";
dataname=string(UUIDs.uuid4()), dataname="NA",
nats_url::String = DEFAULT_NATS_URL, nats_url::String = DEFAULT_NATS_URL,
fileserver_url::String = DEFAULT_FILESERVER_URL, fileserver_url::String = DEFAULT_FILESERVER_URL,
fileServerUploadHandler::Function=plik_oneshot_upload, # a function to handle uploading data to specific HTTP fileserver fileServerUploadHandler::Function=plik_oneshot_upload, # a function to handle uploading data to specific HTTP fileserver
@@ -217,7 +217,7 @@ function smartsend(
type = type, type = type,
transport = "link", transport = "link",
url = url, url = url,
metadata = Dict("content_length" => payload_size, "format" => "arrow_ipc_stream") metadata = Dict("dataname" => dataname, "content_length" => payload_size, "format" => "arrow_ipc_stream")
) )
msg_json = envelope_to_json(env) # Convert envelope to JSON msg_json = envelope_to_json(env) # Convert envelope to JSON

View File

@@ -69,7 +69,6 @@ function test_large_binary_receive()
# Use NATSBridge.smartreceive to handle the data # Use NATSBridge.smartreceive to handle the data
result = NATSBridge.smartreceive(msg) result = NATSBridge.smartreceive(msg)
# println("envelope----- ", result.envelope)
# Check transport type # Check transport type
if result.envelope.transport == "direct" if result.envelope.transport == "direct"
log_trace("Received direct transport with ---- bytes") log_trace("Received direct transport with ---- bytes")
@@ -85,11 +84,12 @@ function test_large_binary_receive()
log_trace("Received $(file_size) bytes of binary data") log_trace("Received $(file_size) bytes of binary data")
# Save received data to a test file # Save received data to a test file
#[WORKING] add dataname so I know it is a file dataname = result.envelope.metadata["dataname"]
filename = basename(result.envelope.url) if dataname != "NA"
output_path = "./new_$filename" output_path = "./new_$dataname"
write(output_path, result.data) write(output_path, result.data)
log_trace("Saved received data to $output_path") log_trace("Saved received data to $output_path")
end
# Verify file size # Verify file size
original_size = length(read(LARGE_FILE_PATH)) original_size = length(read(LARGE_FILE_PATH))