mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	STOMP bugfix: msg.topic can't be used with STOMP out node and ack node (#1009)
* Bugfix: not responsive to msg.topic on input of STOMP out node * Bugfix: not responsive to msg.topic on input of STOMP ack and out node * Bugfix: backward compatible node.topic has prio + Docs: added info about msg.topic in ACK node docs * Typo fix
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							983cab970e
						
					
				
				
					commit
					8743c2afa6
				
			@@ -197,6 +197,7 @@
 | 
				
			|||||||
    <p>
 | 
					    <p>
 | 
				
			||||||
        The node allows for following inputs:
 | 
					        The node allows for following inputs:
 | 
				
			||||||
        <ul>
 | 
					        <ul>
 | 
				
			||||||
 | 
					            <li><code>msg.topic</code>The topic for which the message should be acknowledged, if the <b>Destination</b> field is set the msg.topic will be overwritten by this value</li>
 | 
				
			||||||
            <li><code>msg.messageId</code>: The id of the message to acknowledge</li>
 | 
					            <li><code>msg.messageId</code>: The id of the message to acknowledge</li>
 | 
				
			||||||
            <li><code>msg.transaction</code>: Optional transaction name</li>
 | 
					            <li><code>msg.transaction</code>: Optional transaction name</li>
 | 
				
			||||||
        </ul>
 | 
					        </ul>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -420,15 +420,21 @@ module.exports = function(RED) {
 | 
				
			|||||||
            setStatusDisconnected(node);
 | 
					            setStatusDisconnected(node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            node.on("input", function(msg, send, done) {
 | 
					            node.on("input", function(msg, send, done) {
 | 
				
			||||||
                if (node.topic && msg.payload) {
 | 
					                const topic = node.topic || msg.topic;
 | 
				
			||||||
 | 
					                if (topic.length > 0 && msg.payload) {
 | 
				
			||||||
                    try {
 | 
					                    try {
 | 
				
			||||||
                        msg.payload = JSON.stringify(msg.payload);
 | 
					                        msg.payload = JSON.stringify(msg.payload);
 | 
				
			||||||
                    } catch {
 | 
					                    } catch {
 | 
				
			||||||
                        msg.payload = `${msg.payload}`;
 | 
					                        msg.payload = `${msg.payload}`;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    node.serverConnection.publish(node.topic, msg.payload, msg.headers || {});
 | 
					                    node.serverConnection.publish(topic, msg.payload, msg.headers || {});
 | 
				
			||||||
                    done();
 | 
					                } else if (!topic.length > 0) {
 | 
				
			||||||
 | 
					                    node.warn('No valid publish topic');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    node.warn('Payload or topic is undefined/null')
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                done();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            node.serverConnection.register(node);
 | 
					            node.serverConnection.register(node);
 | 
				
			||||||
@@ -463,7 +469,15 @@ module.exports = function(RED) {
 | 
				
			|||||||
            setStatusDisconnected(node);
 | 
					            setStatusDisconnected(node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            node.on("input", function(msg, send, done) {
 | 
					            node.on("input", function(msg, send, done) {
 | 
				
			||||||
                node.serverConnection.ack(node.topic, msg.messageId, msg.transaction);
 | 
					                const topic = node.topic || msg.topic;
 | 
				
			||||||
 | 
					                if (topic.length > 0) {
 | 
				
			||||||
 | 
					                    node.serverConnection.ack(topic, msg.messageId, msg.transaction);
 | 
				
			||||||
 | 
					                } else if (!topic.length > 0) {
 | 
				
			||||||
 | 
					                    node.warn('No valid publish topic');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    node.warn('Payload or topic is undefined/null')
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                done();
 | 
					                done();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user