test_smartreceive_function #1
@@ -162,7 +162,7 @@ function smartsend(
|
||||
subject::String, # smartreceive's subject
|
||||
data::Any,
|
||||
type::String = "json";
|
||||
dataname=string(UUIDs.uuid4()),
|
||||
dataname="NA",
|
||||
nats_url::String = DEFAULT_NATS_URL,
|
||||
fileserver_url::String = DEFAULT_FILESERVER_URL,
|
||||
fileServerUploadHandler::Function=plik_oneshot_upload, # a function to handle uploading data to specific HTTP fileserver
|
||||
@@ -217,7 +217,7 @@ function smartsend(
|
||||
type = type,
|
||||
transport = "link",
|
||||
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
|
||||
|
||||
@@ -69,7 +69,6 @@ function test_large_binary_receive()
|
||||
|
||||
# Use NATSBridge.smartreceive to handle the data
|
||||
result = NATSBridge.smartreceive(msg)
|
||||
# println("envelope----- ", result.envelope)
|
||||
# Check transport type
|
||||
if result.envelope.transport == "direct"
|
||||
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")
|
||||
|
||||
# Save received data to a test file
|
||||
#[WORKING] add dataname so I know it is a file
|
||||
filename = basename(result.envelope.url)
|
||||
output_path = "./new_$filename"
|
||||
dataname = result.envelope.metadata["dataname"]
|
||||
if dataname != "NA"
|
||||
output_path = "./new_$dataname"
|
||||
write(output_path, result.data)
|
||||
log_trace("Saved received data to $output_path")
|
||||
end
|
||||
|
||||
# Verify file size
|
||||
original_size = length(read(LARGE_FILE_PATH))
|
||||
Reference in New Issue
Block a user