update
This commit is contained in:
BIN
new_testFile_small.zip
Normal file
BIN
new_testFile_small.zip
Normal file
Binary file not shown.
@@ -571,9 +571,7 @@ function smartreceive(
|
|||||||
)
|
)
|
||||||
# Parse the JSON envelope
|
# Parse the JSON envelope
|
||||||
json_data = JSON.parse(String(msg.payload))
|
json_data = JSON.parse(String(msg.payload))
|
||||||
println("R1 ----------")
|
|
||||||
PrettyPrinting.pprintln(json_data)
|
PrettyPrinting.pprintln(json_data)
|
||||||
println("R1 ==========")
|
|
||||||
log_trace(json_data["correlationId"], "Processing received message") # Log message processing start
|
log_trace(json_data["correlationId"], "Processing received message") # Log message processing start
|
||||||
|
|
||||||
# Process all payloads in the envelope
|
# Process all payloads in the envelope
|
||||||
@@ -605,9 +603,7 @@ function smartreceive(
|
|||||||
log_trace(json_data["correlationId"], "Link transport - fetching '$dataname' from URL") # Log link transport handling
|
log_trace(json_data["correlationId"], "Link transport - fetching '$dataname' from URL") # Log link transport handling
|
||||||
|
|
||||||
# Extract download URL from the payload
|
# Extract download URL from the payload
|
||||||
println("R2 ----------")
|
|
||||||
PrettyPrinting.pprintln(payload)
|
PrettyPrinting.pprintln(payload)
|
||||||
println("R2 ==========")
|
|
||||||
url = String(payload["data"])
|
url = String(payload["data"])
|
||||||
|
|
||||||
# Fetch with exponential backoff using the download handler
|
# Fetch with exponential backoff using the download handler
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ correlation_id = string(uuid4())
|
|||||||
# test file transfer #
|
# test file transfer #
|
||||||
# ------------------------------------------------------------------------------------------------ #
|
# ------------------------------------------------------------------------------------------------ #
|
||||||
|
|
||||||
# File path for large binary payload test
|
|
||||||
const FILE_PATH = "./testFile_large.zip"
|
|
||||||
const filename = basename(FILE_PATH)
|
|
||||||
|
|
||||||
# Helper: Log with correlation ID
|
# Helper: Log with correlation ID
|
||||||
function log_trace(message)
|
function log_trace(message)
|
||||||
@@ -65,18 +62,27 @@ end
|
|||||||
# Sender: Send large binary file via smartsend
|
# Sender: Send large binary file via smartsend
|
||||||
function test_large_binary_send()
|
function test_large_binary_send()
|
||||||
# Read the large file as binary data
|
# Read the large file as binary data
|
||||||
log_trace("Reading file: $FILE_PATH")
|
|
||||||
file_data = read(FILE_PATH)
|
|
||||||
|
|
||||||
file_size = length(file_data)
|
# test data 1
|
||||||
log_trace("File size: $file_size bytes")
|
file_path1 = "./testFile_large.zip"
|
||||||
|
file_data1 = read(file_path1)
|
||||||
|
filename1 = basename(file_path1)
|
||||||
|
data1 = (filename1, file_data1, "binary")
|
||||||
|
|
||||||
|
# test data 2
|
||||||
|
file_path2 = "./testFile_small.zip"
|
||||||
|
file_data2 = read(file_path2)
|
||||||
|
filename2 = basename(file_path2)
|
||||||
|
data2 = (filename2, file_data2, "binary")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Use smartsend with binary type - will automatically use link transport
|
# Use smartsend with binary type - will automatically use link transport
|
||||||
# if file size exceeds the threshold (1MB by default)
|
# if file size exceeds the threshold (1MB by default)
|
||||||
# API: smartsend(subject, [(dataname, data, type), ...]; keywords...)
|
# API: smartsend(subject, [(dataname, data, type), ...]; keywords...)
|
||||||
env = NATSBridge.smartsend(
|
env = NATSBridge.smartsend(
|
||||||
SUBJECT,
|
SUBJECT,
|
||||||
[(filename, file_data, "binary")], # List of (dataname, data, type) tuples
|
[data1, data2], # List of (dataname, data, type) tuples
|
||||||
nats_url = NATS_URL;
|
nats_url = NATS_URL;
|
||||||
fileserver_url = FILESERVER_URL,
|
fileserver_url = FILESERVER_URL,
|
||||||
fileserverUploadHandler = plik_upload_handler,
|
fileserverUploadHandler = plik_upload_handler,
|
||||||
@@ -105,7 +111,6 @@ end
|
|||||||
# Run the test
|
# Run the test
|
||||||
println("Starting large binary payload test...")
|
println("Starting large binary payload test...")
|
||||||
println("Correlation ID: $correlation_id")
|
println("Correlation ID: $correlation_id")
|
||||||
println("File: $FILE_PATH")
|
|
||||||
|
|
||||||
# Run sender first
|
# Run sender first
|
||||||
println("start smartsend")
|
println("start smartsend")
|
||||||
|
|||||||
Reference in New Issue
Block a user