-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpubsub-in.html
87 lines (81 loc) · 3.57 KB
/
pubsub-in.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!--
Copyright 2019 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="google-cloud-pubsub in">
<div class="form-row">
<label for="node-input-account"><i class="fa fa-user"></i> Credentials</label>
<input type="text" id="node-input-account">
</div>
<div class="form-row">
<label for="node-input-keyFilename"><i class="fa fa-user"></i> Key File</label>
<input type="text" id="node-input-keyFilename">
</div>
<div class="form-row">
<label for="node-input-subscription"><i class="fa fa-bars"></i> Subscription</label>
<input type="text" id="node-input-subscription">
</div>
<div>
<label for="node-input-assumeJSON"><i class="fa fa-code"></i> Assume JSON
<input type="checkbox" id="node-input-assumeJSON" style="vertical-align: top;">
</label>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="google-cloud-pubsub in">
<p>Connects to <a href="https://cloud.google.com/pubsub/docs/" target="_blank">Google Cloud Pub/Sub</a> and subscribes to a specific topic.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>msg.payload
<span class="property-type">PubSub Message</span>
</dt>
<dd>The data from the Pub/Sub message.</dd>
</dl>
<h3>Details</h3>
<p>
This node receives a message that has been published to a topic. During configuration, the property called Subscription
is used to name the GCP Subscription that we are watching.
</p>
<p>
This is an event generating node and as such has no inputs. When a message is received, the flowing msg will contain a
payload property corresponding to a GCP Pub/Sub message data payload. In addition, the msg.message will contain a read-only copy of the original message.
This is described <a href="https://cloud.google.com/nodejs/docs/reference/pubsub/0.28.x/Message">here</a>. The message is auto acknowledged
</p>
<p>
If we know that the incoming message contains a data payload that is JSON encoded, a configuration option called
Assume JSON can be selected. When selected, the content of the message is parsed from a JSON string to an object
representation and stored at <code>msg.payload</code>.
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType("google-cloud-pubsub in", {
category: "GCP",
defaults: {
account: { type: "google-cloud-credentials", required: false },
keyFilename: {value: "", required: false },
subscription: { required: true },
assumeJSON: {value: false, required: false },
name: { value: "", required: false }
},
inputs: 0,
outputs: 1,
icon: "cloudpubsub.png",
align: "left",
color: "#3FADB5",
label: function () {
return this.name || this.topic || "pubsub";
},
paletteLabel: "pubsub"
});
</script>