Node Red client for Redis with pub/sub, list, lua scripting, ssl, cluster, custom commands, instance injection and other commands support.
Now uses same connection per flow and open new if you set block connection option.
Roadmap:
- (partial via instance injection)Stream Support
- (ok)Flow or Global redis instance injection to use on function Node.
- (wip)Better Validations
- (instance injection)Custom Commands support(Modules)
See the Sample flow before ask how this module works.
Please test and make feedback.
I need contributors...
Redis Commands:
Payload -> Redis
Redis Queue:
Sample flow:
[{"id":"31f1fcb.a6a4a04","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":240,"wires":[]},{"id":"80d063ee.78deb8","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":240,"wires":[["4cb7b20e.778d34"]]},{"id":"4cb7b20e.778d34","type":"redis-out","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"rpush","name":"","topic":"test","x":450,"y":200,"wires":[]},{"id":"902b8385.2fdd9","type":"redis-in","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"blpop","name":"","topic":"test","timeout":0,"x":450,"y":240,"wires":[["31f1fcb.a6a4a04"]]},{"id":"6373a8a4.82bad","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"{\"a\":1,\"b\":2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":200,"wires":[["4cb7b20e.778d34"]]},{"id":"f248c9ea.674658","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"getset","name":"","topic":"timestamp","params":"[]","paramsType":"json","payloadType":"json","block":false,"x":430,"y":300,"wires":[["3351713f.42e916"]]},{"id":"424ef610.bbb3a8","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":300,"wires":[["f248c9ea.674658"]]},{"id":"3351713f.42e916","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":300,"wires":[]},{"id":"ba433622.8c6178","type":"catch","z":"f80412b1.e2ee8","name":"","scope":null,"uncaught":false,"x":460,"y":140,"wires":[["ec2978af.3e0458"]]},{"id":"ec2978af.3e0458","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":140,"wires":[]},{"id":"eccd31de.55e3a","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"set","name":"","topic":"","params":"[]","paramsType":"json","payloadType":"json","block":false,"x":380,"y":360,"wires":[["6ac31b1f.b393c4"]]},{"id":"46f5d0c0.8a7198","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"[\"key\",\"value\"]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":360,"wires":[["eccd31de.55e3a"]]},{"id":"6ac31b1f.b393c4","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":360,"wires":[]},{"id":"9f960d71.749988","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"getset","name":"","topic":"","params":"[]","paramsType":"json","payloadType":"json","block":false,"x":390,"y":420,"wires":[["7cef7ea5.dba3b"]]},{"id":"f16ad786.8b294","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"key","payload":"[\"value\"]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":420,"wires":[["9f960d71.749988"]]},{"id":"7cef7ea5.dba3b","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":420,"wires":[]},{"id":"7e45a50c.240f7c","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"hmset","name":"","topic":"","params":"[]","paramsType":"json","payloadType":"json","block":false,"x":390,"y":540,"wires":[["122ff416.a56b8c"]]},{"id":"488a7f5b.a40628","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"myHash","payload":"{\"a\":1,\"b\":2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":540,"wires":[["7e45a50c.240f7c"]]},{"id":"122ff416.a56b8c","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":540,"wires":[]},{"id":"aff97bc7.84a578","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":600,"wires":[["1676f695.aa7189"]]},{"id":"2f4295b5.f78d42","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":600,"wires":[]},{"id":"1676f695.aa7189","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"hgetall","name":"","topic":"myHash","params":"{}","paramsType":"json","payloadType":"json","block":false,"x":420,"y":600,"wires":[["2f4295b5.f78d42"]]},{"id":"66098945.141118","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":660,"wires":[["e42d2b3b.6bb"]]},{"id":"e23fbe8.d7505c","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":660,"wires":[]},{"id":"e42d2b3b.6bb","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"sadd","name":"","topic":"mySet","params":"[\"memberA\",\"memberB\",\"memberC\"]","paramsType":"json","payloadType":"json","block":false,"x":410,"y":660,"wires":[["e23fbe8.d7505c"]]},{"id":"2163c482.b8a244","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"get","name":"","topic":"","params":"[]","paramsType":"json","payloadType":"json","block":false,"x":380,"y":480,"wires":[["d2ea99d4.a4c51"]]},{"id":"b5f040ea.800be8","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"key","payload":"[]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":480,"wires":[["2163c482.b8a244"]]},{"id":"d2ea99d4.a4c51","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":480,"wires":[]},{"id":"15f62858.26419","type":"redis-lua-script","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","name":"test","keyval":0,"func":"local text = \"Hello World\"\nreturn text","stored":true,"block":false,"x":370,"y":780,"wires":[["4a40fc2d.b70e2c"]]},{"id":"4f1fc69d.539ee","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":780,"wires":[["15f62858.26419"]]},{"id":"4a40fc2d.b70e2c","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":780,"wires":[]},{"id":"6ebb1fdf.2fce","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":720,"wires":[["5a3d77f4.920fd8"]]},{"id":"bac6944e.4e07","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":720,"wires":[]},{"id":"5a3d77f4.920fd8","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"sismember","name":"","topic":"mySet","params":"[\"memberA\"]","paramsType":"json","payloadType":"json","block":false,"x":430,"y":720,"wires":[["bac6944e.4e07"]]},{"id":"c1c3a5a6.c289f","type":"redis-lua-script","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","name":"test2","keyval":0,"func":"local text = \"Hello2222 World2222\"\nreturn text","stored":false,"block":false,"x":370,"y":840,"wires":[["d8bd4107.683c08"]]},{"id":"9013d649.88c35","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":840,"wires":[["c1c3a5a6.c289f"]]},{"id":"d8bd4107.683c08","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":840,"wires":[]},{"id":"cb44db96.c64bb8","type":"redis-in","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"psubscribe","name":"","topic":"TOPIC:*","timeout":0,"x":460,"y":20,"wires":[["78033f6c.31797"]]},{"id":"78033f6c.31797","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":20,"wires":[]},{"id":"dac5fcff.4c4cb","type":"redis-in","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"subscribe","name":"","topic":"TOPIC:OK","timeout":0,"x":460,"y":80,"wires":[["6f01eb54.501e7c"]]},{"id":"6f01eb54.501e7c","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":80,"wires":[]},{"id":"e0d2924b.210708","type":"redis-out","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"publish","name":"","topic":"TOPIC:OK","x":190,"y":140,"wires":[]},{"id":"d1fc59dc.bd4958","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"{\"a\":1,\"b\":2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":40,"wires":[["e0d2924b.210708"]]},{"id":"3e05b777.781bd8","type":"redis-command","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","command":"del","name":"","topic":"","params":"[]","paramsType":"json","payloadType":"json","block":false,"x":380,"y":900,"wires":[["fd036d2b.dc6d38"]]},{"id":"6924006.91553","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"key","payload":"[]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":900,"wires":[["3e05b777.781bd8"]]},{"id":"fd036d2b.dc6d38","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":900,"wires":[]},{"id":"a13d2797.8a7ff","type":"redis-instance","z":"f80412b1.e2ee8","server":"a0efbb89.5e42d8","name":"","topic":"redis","location":"flow","block":false,"x":130,"y":960,"wires":[]},{"id":"2a93e7ce.341078","type":"inject","z":"f80412b1.e2ee8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":1000,"wires":[["d89709ef.fd9368"]]},{"id":"d89709ef.fd9368","type":"function","z":"f80412b1.e2ee8","name":"","func":"let redis = context.flow.get('redis');\n\nredis.info().then((data)=>{\n msg.payload = data\n node.send(msg);\n})\n\n/*\nredis.call(\"anycmd\").then((data)=>{\n msg.payload = data\n node.send(msg);\n})*/","outputs":1,"noerr":0,"x":370,"y":1000,"wires":[["f2e9c3a0.8f181"]]},{"id":"f2e9c3a0.8f181","type":"debug","z":"f80412b1.e2ee8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":690,"y":1000,"wires":[]},{"id":"a0efbb89.5e42d8","type":"redis-config","z":"","name":"local","options":"{}","cluster":false,"optionsType":"json"}]