From 55ba9c89ed4c76b4bf5fa6cad529a58b64f6ca40 Mon Sep 17 00:00:00 2001 From: Olivier Verhaegen <56387556+OlivierVerhaegen@users.noreply.github.com> Date: Wed, 7 Jun 2023 14:16:57 +0200 Subject: [PATCH] Bugfix: not responsive to msg.topic on input of STOMP out node --- io/stomp/18-stomp.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/io/stomp/18-stomp.js b/io/stomp/18-stomp.js index 8819f857..ec717e4d 100644 --- a/io/stomp/18-stomp.js +++ b/io/stomp/18-stomp.js @@ -420,15 +420,21 @@ module.exports = function(RED) { setStatusDisconnected(node); node.on("input", function(msg, send, done) { - if (node.topic && msg.payload) { + const topic = msg.topic || node.topic; + if (topic.length > 0 && msg.payload) { try { msg.payload = JSON.stringify(msg.payload); } catch { msg.payload = `${msg.payload}`; } node.serverConnection.publish(node.topic, msg.payload, msg.headers || {}); - done(); + } else if (!topic.length > 0) { + node.warn('No valid publish topic'); + + } else { + node.warn('Payload is undefined or null') } + done(); }); node.serverConnection.register(node);