rename to smartpack n smartunpack

This commit is contained in:
2026-05-18 19:30:58 +07:00
parent cc95bc97d3
commit 396e0848da
21 changed files with 323 additions and 314 deletions

View File

@@ -1,6 +1,6 @@
/**
* JavaScript Mix Payloads Receiver Test
* Tests the smartreceive function with mixed payload types
* Tests the smartunpack function with mixed payload types
*
* This test mirrors test_julia_mix_payloads_receiver.jl and demonstrates that
* any combination and any number of mixed content can be received correctly.
@@ -50,8 +50,8 @@ async function runTest() {
console.log(`Received message on ${msg.subject}`);
try {
// Process the message using smartreceive
const envelope = await msghandler.smartreceive(msg, {
// Process the message using smartunpack
const envelope = await msghandler.smartunpack(msg, {
fileserver_download_handler: msghandler.fetchWithBackoff,
max_retries: 5,
base_delay: 100,

View File

@@ -1,6 +1,6 @@
/**
* JavaScript Mix Payloads Sender Test
* Tests the smartsend function with mixed payload types
* Tests the smartpack function with mixed payload types
*
* This test mirrors test_julia_mix_payloads_sender.jl and demonstrates that
* any combination and any number of mixed content can be sent correctly.
@@ -169,7 +169,7 @@ async function runTest() {
try {
// Send the message
console.log('Sending mixed payloads...\n');
const [env, envJsonStr] = await msghandler.smartsend(
const [env, envJsonStr] = await msghandler.smartpack(
TEST_SUBJECT,
payloads,
{

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env julia
# Test script for mixed-content message testing
# Tests receiving a mix of text, json, table, image, audio, video, and binary data
# from Julia serviceA to Julia serviceB using msghandler.jl smartreceive
# from Julia serviceA to Julia serviceB using msghandler.jl smartunpack
#
# This test demonstrates that any combination and any number of mixed content
# can be sent and received correctly.
@@ -36,9 +36,9 @@ function test_mix_receive()
NATS.subscribe(conn, SUBJECT) do msg
log_trace("Received message on $(msg.subject)")
# Use msghandler.smartreceive to handle the data
# API: smartreceive(msg, download_handler; max_retries, base_delay, max_delay)
result = msghandler.smartreceive(
# Use msghandler.smartunpack to handle the data
# API: smartunpack(msg, download_handler; max_retries, base_delay, max_delay)
result = msghandler.smartunpack(
msg;
max_retries = 5,
base_delay = 100,
@@ -245,7 +245,7 @@ println("Note: This receiver will wait for messages from the sender.")
println("Run test_julia_to_julia_mix_sender.jl first to send test data.")
# Run receiver
println("\ntesting smartreceive for mixed content")
println("\ntesting smartunpack for mixed content")
test_mix_receive()
println("\nTest completed.")

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env julia
# Test script for mixed-content message testing
# Tests sending a mix of text, dictionary, arrowtable, jsontable, image, audio, video, and binary data
# from Julia serviceA to Julia serviceB using msghandler.jl smartsend
# from Julia serviceA to Julia serviceB using msghandler.jl smartpack
#
# This test demonstrates that any combination and any number of mixed content
# can be sent and received correctly.
@@ -166,7 +166,7 @@ function create_sample_data()
end
# Sender: Send mixed content via smartsend
# Sender: Send mixed content via smartpack
function test_mix_send()
# Create sample data
(text_data, dict_data, arrow_table_small, arrow_table_large, json_table_small, json_table_large, audio_data, large_audio_data, video_data, large_video_data, binary_data, large_binary_data) = create_sample_data()
@@ -203,8 +203,8 @@ function test_mix_send()
("binary_file_large", large_binary_data, "binary")
]
# Use smartsend with mixed content
sendinfo = msghandler.smartsend(
# Use smartpack with mixed content
sendinfo = msghandler.smartpack(
SUBJECT,
payloads; # List of (dataname, data, type) tuples
broker_url = NATS_URL,
@@ -251,7 +251,7 @@ println("Starting mixed-content transport test...")
println("Correlation ID: $correlation_id")
# Run sender
println("start smartsend for mixed content")
println("start smartpack for mixed content")
test_mix_send()
println("\nTest completed.")

View File

@@ -1,6 +1,6 @@
"""
Python Mix Payloads Sender Test
Tests the smartsend function with mixed payload types
Tests the smartpack function with mixed payload types
"""
import asyncio
@@ -11,7 +11,7 @@ import base64
# Add parent directory to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from msghandler import smartsend, DEFAULT_BROKER_URL, DEFAULT_FILESERVER_URL
from msghandler import smartpack, DEFAULT_BROKER_URL, DEFAULT_FILESERVER_URL
TEST_SUBJECT = '/test/mix'
TEST_BROKER_URL = os.environ.get('NATS_URL', 'nats://localhost:4222')
@@ -56,7 +56,7 @@ async def run_test():
try:
# Send the message
print('Sending mixed payloads...')
env, env_json_str = await smartsend(
env, env_json_str = await smartpack(
TEST_SUBJECT,
test_data,
broker_url=TEST_BROKER_URL,
@@ -164,7 +164,7 @@ async def run_test():
('audio', bytes([0x46, 0x4C, 0x41, 0x43]), 'audio')
]
chat_env, _ = await smartsend(
chat_env, _ = await smartpack(
TEST_SUBJECT,
chat_data,
broker_url=TEST_BROKER_URL,