From bf1b9b230e9824518768e93bbbb500cf6429ac62 Mon Sep 17 00:00:00 2001 From: Olivier Verhaegen <56387556+OlivierVerhaegen@users.noreply.github.com> Date: Wed, 12 Apr 2023 11:43:00 +0200 Subject: [PATCH] Add optional subscription id --- io/stomp/18-stomp.html | 10 ++++++++++ io/stomp/18-stomp.js | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/io/stomp/18-stomp.html b/io/stomp/18-stomp.html index 2d652604..10128fb6 100644 --- a/io/stomp/18-stomp.html +++ b/io/stomp/18-stomp.html @@ -8,6 +8,14 @@ +
+ + +
+
+ + +
@@ -33,6 +41,8 @@ defaults: { name: {value:""}, server: {type:"stomp-server",required:true}, + enable_subscriptionid: {value: false}, + subscriptionid: {value: 0, required:true}, topic: {value:"",required:true} }, inputs:0, diff --git a/io/stomp/18-stomp.js b/io/stomp/18-stomp.js index b44b605c..388a84c3 100644 --- a/io/stomp/18-stomp.js +++ b/io/stomp/18-stomp.js @@ -28,6 +28,8 @@ module.exports = function(RED) { RED.nodes.createNode(this,n); this.server = n.server; this.topic = n.topic; + this.enableSubscriptionId = n.enable_subscriptionid; + this.subscriptionid = n.subscriptionid; this.serverConfig = RED.nodes.getNode(this.server); this.stompClientOpts = { @@ -44,7 +46,14 @@ module.exports = function(RED) { if (this.serverConfig.vhost) { this.stompClientOpts.vhost = this.serverConfig.vhost; } - this.subscribeHeaders = this.serverConfig.ack ? { "ack": "client" } : {}; + + this.subscribeHeaders = {}; + if (this.enableSubscriptionId) { + this.subscribeHeaders.id = this.subscriptionid; + } + if (this.serverConfig.ack) { + this.subscribeHeaders.ack = "client"; + } var node = this; var msg = {topic:this.topic};