I want to send the response back when the data is successfully published on mqtt else error response.
[
{
"id": "39ed87cab5b6db6f",
"type": "tab",
"label": " Flow",
"disabled": false,
"info": "",
"env": []
},
{
"id": "de190da7d7f6c752",
"type": "http in",
"z": "39ed87cab5b6db6f",
"name": "",
"url": "/post",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 180,
"y": 200,
"wires": [
[
"d11ecb377bfcb5a3",
"21711cebf6bee721",
"8bb6de24d9bf8ab4"
]
]
},
{
"id": "d11ecb377bfcb5a3",
"type": "function",
"z": "39ed87cab5b6db6f",
"name": "process F",
"func": "\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 200,
"wires": [
[
"153f26082a9cb0ef",
"abf47028f6e7cb50"
]
]
},
{
"id": "21711cebf6bee721",
"type": "debug",
"z": "39ed87cab5b6db6f",
"name": "debug 31",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 440,
"y": 260,
"wires": []
},
{
"id": "153f26082a9cb0ef",
"type": "debug",
"z": "39ed87cab5b6db6f",
"name": "debug 32",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 620,
"y": 260,
"wires": []
},
{
"id": "abf47028f6e7cb50",
"type": "mqtt out",
"z": "39ed87cab5b6db6f",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "59ecab9cb8a349eb",
"x": 630,
"y": 200,
"wires": []
},
{
"id": "43142f98d5f780aa",
"type": "http response",
"z": "39ed87cab5b6db6f",
"name": "http response",
"statusCode": "202",
"headers": {},
"x": 660,
"y": 140,
"wires": []
},
{
"id": "8bb6de24d9bf8ab4",
"type": "function",
"z": "39ed87cab5b6db6f",
"name": "Http response F",
"func": "msg.payload = 'success';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 140,
"wires": [
[
"43142f98d5f780aa"
]
]
},
{
"id": "eaf1cd8c619efe5e",
"type": "complete",
"z": "39ed87cab5b6db6f",
"name": "",
"scope": [
"abf47028f6e7cb50"
],
"uncaught": false,
"x": 270,
"y": 340,
"wires": [
[
"43142f98d5f780aa"
]
]
},
{
"id": "59ecab9cb8a349eb",
"type": "mqtt-broker",
"name": "mqtt in",
"broker": "test.mosquitto.org",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]