update
This commit is contained in:
@@ -462,7 +462,7 @@ async function smartsend(subject, data, options = {}) {
|
||||
* @param {string} options.replyToMsgId - Message ID this message is replying to (default: "")
|
||||
* @param {boolean} options.isPublish - Whether to automatically publish the message to NATS (default: true)
|
||||
*
|
||||
* @returns {Promise<Object>} - An object with { env: MessageEnvelope, msg_json_str: string }
|
||||
* @returns {Promise<Object>} - An object with { env: MessageEnvelope, env_json_str: string }
|
||||
*/
|
||||
const {
|
||||
natsUrl = DEFAULT_NATS_URL,
|
||||
@@ -559,17 +559,17 @@ async function smartsend(subject, data, options = {}) {
|
||||
});
|
||||
|
||||
// Convert envelope to JSON string
|
||||
const msg_json_str = env.toString();
|
||||
const env_json_str = env.toString();
|
||||
|
||||
// Publish to NATS if isPublish is true
|
||||
if (isPublish) {
|
||||
await publish_message(natsUrl, subject, msg_json_str, correlationId);
|
||||
await publish_message(natsUrl, subject, env_json_str, correlationId);
|
||||
}
|
||||
|
||||
// Return both envelope and JSON string (tuple-like structure)
|
||||
return {
|
||||
env: env,
|
||||
msg_json_str: msg_json_str
|
||||
env_json_str: env_json_str
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user