node-red-contrib-qrusty 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/package.json +19 -0
- package/qrusty-consume.js +9 -0
- package/qrusty-publish.js +11 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# node-red-contrib-qrusty
|
|
2
|
+
|
|
3
|
+
Node-RED Function node snippets for interacting with a Qrusty server.
|
|
4
|
+
|
|
5
|
+
## Notes
|
|
6
|
+
|
|
7
|
+
- Default server URL in examples assumes Docker Compose service name `queue-server` on port `6784`.
|
|
8
|
+
- Qrusty expects `payload` to be a JSON string for `POST /publish`, so the publish snippet uses `JSON.stringify(msg.payload)`.
|
|
9
|
+
|
|
10
|
+
## Included snippets
|
|
11
|
+
|
|
12
|
+
- `qrusty-publish.js` (POST `/publish`)
|
|
13
|
+
- `qrusty-consume.js` (POST `/consume/{queue}`)
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "node-red-contrib-qrusty",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Node-RED nodes for Qrusty priority queue server",
|
|
5
|
+
"author": "Gordon Greene <greeng3@obscure-reference.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"node-red",
|
|
9
|
+
"qrusty",
|
|
10
|
+
"queue",
|
|
11
|
+
"priority"
|
|
12
|
+
],
|
|
13
|
+
"node-red": {
|
|
14
|
+
"nodes": {
|
|
15
|
+
"qrusty-publish": "qrusty-publish.js",
|
|
16
|
+
"qrusty-consume": "qrusty-consume.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Function node for consuming from qrusty
|
|
2
|
+
msg.url = "http://queue-server:6784/consume/" + (msg.queue || "default_queue");
|
|
3
|
+
msg.method = "POST";
|
|
4
|
+
msg.payload = {
|
|
5
|
+
consumer_id: msg.consumer_id || "node-red-consumer",
|
|
6
|
+
timeout_seconds: msg.timeout_seconds || 30,
|
|
7
|
+
};
|
|
8
|
+
msg.headers = { "Content-Type": "application/json" };
|
|
9
|
+
return msg;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Function node for publishing to qrusty
|
|
2
|
+
msg.url = "http://queue-server:6784/publish";
|
|
3
|
+
msg.method = "POST";
|
|
4
|
+
msg.payload = {
|
|
5
|
+
queue: "my_queue",
|
|
6
|
+
priority: msg.priority || 1000,
|
|
7
|
+
payload: JSON.stringify(msg.payload),
|
|
8
|
+
max_retries: 3,
|
|
9
|
+
};
|
|
10
|
+
msg.headers = { "Content-Type": "application/json" };
|
|
11
|
+
return msg;
|