mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Add optional subscription id
This commit is contained in:
parent
54ec71f16c
commit
bf1b9b230e
@ -8,6 +8,14 @@
|
|||||||
<label for="node-input-topic" style="width: 110px;"><i class="fa fa-envelope"></i> Destination</label>
|
<label for="node-input-topic" style="width: 110px;"><i class="fa fa-envelope"></i> Destination</label>
|
||||||
<input type="text" id="node-input-topic" placeholder="topic or queue">
|
<input type="text" id="node-input-topic" placeholder="topic or queue">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-enable_subscriptionid" style="width: 110px;"><i class="fa fa-envelope"></i> Destination</label>
|
||||||
|
<input type="checkbox" id="node-input-enable_subscriptionid">
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-subscriptionid" style="width: 110px;"><i class="fa fa-envelope"></i> Destination</label>
|
||||||
|
<input type="number" id="node-input-subscriptionid">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name" style="width: 110px;"><i class="fa fa-tag"></i> Name</label>
|
<label for="node-input-name" style="width: 110px;"><i class="fa fa-tag"></i> Name</label>
|
||||||
<input type="text" id="node-input-name" placeholder="Name">
|
<input type="text" id="node-input-name" placeholder="Name">
|
||||||
@ -33,6 +41,8 @@
|
|||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
server: {type:"stomp-server",required:true},
|
server: {type:"stomp-server",required:true},
|
||||||
|
enable_subscriptionid: {value: false},
|
||||||
|
subscriptionid: {value: 0, required:true},
|
||||||
topic: {value:"",required:true}
|
topic: {value:"",required:true}
|
||||||
},
|
},
|
||||||
inputs:0,
|
inputs:0,
|
||||||
|
@ -28,6 +28,8 @@ module.exports = function(RED) {
|
|||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.server = n.server;
|
this.server = n.server;
|
||||||
this.topic = n.topic;
|
this.topic = n.topic;
|
||||||
|
this.enableSubscriptionId = n.enable_subscriptionid;
|
||||||
|
this.subscriptionid = n.subscriptionid;
|
||||||
|
|
||||||
this.serverConfig = RED.nodes.getNode(this.server);
|
this.serverConfig = RED.nodes.getNode(this.server);
|
||||||
this.stompClientOpts = {
|
this.stompClientOpts = {
|
||||||
@ -44,7 +46,14 @@ module.exports = function(RED) {
|
|||||||
if (this.serverConfig.vhost) {
|
if (this.serverConfig.vhost) {
|
||||||
this.stompClientOpts.vhost = 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 node = this;
|
||||||
var msg = {topic:this.topic};
|
var msg = {topic:this.topic};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user