[ { "id": "465920a81d581840", "type": "tab", "label": "MQ", "disabled": false, "info": "", "env": [] }, { "id": "7e0417e925cf97a8", "type": "inject", "z": "465920a81d581840", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 240, "wires": [ [ "c923cdb3575b9d40" ] ] }, { "id": "93300d905d01294d", "type": "zrocketmqIn", "z": "465920a81d581840", "name": "", "x": 530, "y": 360, "wires": [ [ "37ce08e0843e58f8" ] ] }, { "id": "37ce08e0843e58f8", "type": "debug", "z": "465920a81d581840", "name": "调试 18", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 720, "y": 360, "wires": [] }, { "id": "6465b1705f4e832c", "type": "inject", "z": "465920a81d581840", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 360, "wires": [ [ "88b3d7d86cebb70f" ] ] }, { "id": "88b3d7d86cebb70f", "type": "function", "z": "465920a81d581840", "name": "发送消息配置", "func": "msg.rocketmqCfg={\n endpoints: '127.0.0.1:8081',\n}\n\nmsg.payload={\n topic: 'TestTopic',\n // tag: 'nodejs-demo1',\n body: Buffer.from(JSON.stringify({\n hello: 'rocketmq-client-nodejs world 😄',\n now: Date(),\n })),\n}\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 340, "y": 360, "wires": [ [ "93300d905d01294d" ] ] }, { "id": "c923cdb3575b9d40", "type": "function", "z": "465920a81d581840", "name": "初始化后持续侦听", "func": "msg.rocketmqCfg={\n consumerGroup: 'nodejs-group',\n endpoints: '127.0.0.1:8081',\n subscriptions: new Map().set('TestTopic', '*'),\n autoConsume:true\n}\nmsg.idleSleep = 500 //拉取消息间隔\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 240, "wires": [ [ "b8081045fe71adda" ] ] }, { "id": "b8081045fe71adda", "type": "zrocketmqOut", "z": "465920a81d581840", "name": "", "x": 540, "y": 240, "wires": [ [ "016073c3d6aec55b" ] ] }, { "id": "45f4b7656458e538", "type": "debug", "z": "465920a81d581840", "name": "调试 20", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 920, "y": 240, "wires": [] }, { "id": "016073c3d6aec55b", "type": "function", "z": "465920a81d581840", "name": "接收消息处理", "func": "\nif (msg.payload && msg.payload.length > 0) {\n msg.payload = msg.payload.map((data) => {\n data.body = JSON.parse(data.body.toString())\n return data;\n })\n}\n\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 740, "y": 240, "wires": [ [ "45f4b7656458e538" ] ] }, { "id": "39cc41099e1989e9", "type": "function", "z": "465920a81d581840", "name": "每次手动拉取消息", "func": "msg.rocketmqCfg={\n consumerGroup: 'nodejs-group',\n endpoints: '127.0.0.1:8081',\n subscriptions: new Map().set('TestTopic', '*'),\n}\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 300, "wires": [ [ "f5df2d17b3f38bc6" ] ] }, { "id": "f5df2d17b3f38bc6", "type": "zrocketmqOut", "z": "465920a81d581840", "name": "", "x": 550, "y": 300, "wires": [ [ "a80b9141fabff9fa" ] ] }, { "id": "a80b9141fabff9fa", "type": "function", "z": "465920a81d581840", "name": "接收消息处理", "func": "msg.payload = msg.payload.map((data)=>{\n data.body = JSON.parse(data.body.toString())\n return data;\n})\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 750, "y": 300, "wires": [ [ "cf89a95a22dec1ad" ] ] }, { "id": "cf89a95a22dec1ad", "type": "debug", "z": "465920a81d581840", "name": "调试 21", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 920, "y": 300, "wires": [] }, { "id": "afb6d76271bd7062", "type": "inject", "z": "465920a81d581840", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 180, "wires": [ [ "4f1b952a282a5c19" ] ] }, { "id": "4f1b952a282a5c19", "type": "function", "z": "465920a81d581840", "name": "停止持续侦听", "func": "msg.rocketmqCfg = {\n consumerGroup: 'nodejs-group',\n endpoints: '127.0.0.1:8081',\n subscriptions: new Map().set('TestTopic', '*'),\n autoConsume: false\n\n}\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 340, "y": 180, "wires": [ [ "b8081045fe71adda" ] ] }, { "id": "cc79dff95ad77416", "type": "inject", "z": "465920a81d581840", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 300, "wires": [ [ "39cc41099e1989e9" ] ] } ]