diff --git a/src/NATSBridge.jl b/src/NATSBridge.jl index 82efbd6..11a7157 100644 --- a/src/NATSBridge.jl +++ b/src/NATSBridge.jl @@ -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 diff --git a/test/test_large_payload.jl b/test/test_julia_julia_data_transfer.jl similarity index 92% rename from test/test_large_payload.jl rename to test/test_julia_julia_data_transfer.jl index ce99c41..ef84a82 100644 --- a/test/test_large_payload.jl +++ b/test/test_julia_julia_data_transfer.jl @@ -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" - write(output_path, result.data) - log_trace("Saved received data to $output_path") + 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))