Aynchronous wait node?

Hi,

is there any kind of "asynchronous wait node" that can be used to forward messages with a fixed delay ?
On the input side many messages are sent in a short period of time (like 10 / sec), but they should be forwarded in fixed time slots (like 1 every 5 sec).

Is that possible or available as node ?

BR
G

You can use the delay node, set it to rate limit and configure your requirements.

Unfortunately this does not work as intended:

Try this node please and tell me why only one message is forwarded instead of 2 if you click the inject node several times:

[
{
"id": "e5cb8c634d4bec13",
"type": "inject",
"z": "afd9ce7fa0e6c13b",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 220,
"y": 600,
"wires": [
[
"f67cd5620450fd1d"
]
]
},
{
"id": "f67cd5620450fd1d",
"type": "delay",
"z": "afd9ce7fa0e6c13b",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "2",
"nbRateUnits": "2",
"rateUnits": "minute",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 500,
"y": 600,
"wires": [
[
"de460a41781c08af"
]
]
},
{
"id": "de460a41781c08af",
"type": "debug",
"z": "afd9ce7fa0e6c13b",
"name": "debug 5",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 760,
"y": 600,
"wires":
}
]

Because this is what you said you wanted.

You need to set it to queue intermediate messages, not drop them

You have to click the </> button before pasting your code. That protects the code from the forum software which will otherwise mangle it.

Your delay node is set to rate limit: 2 messages per 2 minutes.
Note that will send 1 message per minute, not 2 messages, wait 2 minutes, ...

Try this node please and tell me why only one message is forwarded instead of 2 if you click the inject node several times:

You have chosen to drop intermediate messages.
That means that a message is sent, then all messages received in the next minute are thrown away.

You initially said "many messages are sent in a short period of time (like 10 / sec), but they should be forwarded in fixed time slots (like 1 every 5 sec)", However the flow is rate limited 1 per minute.
Perhaps you can clearly describe exactly what you want to achieve, the real rate of incoming messages and the rate you actually want to forward them.

I am checking the availability of a server every second.

If the server goes down I would like to send 2 messages to two receipients. As long as the server stays down I would like to re-send these two messages every 5 minutes.

The idea was to configure the delay node to "Send 2 msg / 5 min" and skip or delete all messages in between (because they are nevertheless re-sent every second).

But it seems that "2 msg / 5min" does not work as expected ...

you want two of the same message sent every 5 minutes? simply connecting the single message out to two different (I assume) email nodes will create two emails, etc.

please post your flow using the "</>" icon or simply wrap your flow code in ``` before and after.

I want a similar message with two different receipients to be sent every 5 minutes, although on the input-side once a second a new input us generated

See the example below: I want to send one message with "Dad" and one with "Mom" in parallel. After that I want to pause for 5 Minutens and re-send one with "Dad" and one with "Mom" again ... forever

[{"id":"3086e47410af607f","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"b2b2c3628bb65d20","type":"inject","z":"3086e47410af607f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":210,"y":200,"wires":[["2a1be6e2687cba71"]]},{"id":"69a2808014af0b46","type":"delay","z":"3086e47410af607f","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"2","nbRateUnits":"5","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":580,"y":200,"wires":[["7baf9ee4643e4171"]]},{"id":"7baf9ee4643e4171","type":"debug","z":"3086e47410af607f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":200,"wires":[]},{"id":"2a1be6e2687cba71","type":"function","z":"3086e47410af607f","name":"","func":"msg.recipient = \"Dad\";\nnode.send(msg);\nmsg.recipient = \"Mom\";\nnode.send(msg);\n\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":200,"wires":[["69a2808014af0b46"]]}]

Split your flow where the common data is all there and now you need to change message specific things for different recipients or whatever.

[{"id":"b2b2c3628bb65d20","type":"inject","z":"3086e47410af607f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":150,"y":220,"wires":[["69a2808014af0b46"]]},{"id":"69a2808014af0b46","type":"delay","z":"3086e47410af607f","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":340,"y":220,"wires":[["3b9b8ade1bd15c83","898ae5f530a41476"]]},{"id":"7baf9ee4643e4171","type":"debug","z":"3086e47410af607f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":160,"wires":[]},{"id":"3b9b8ade1bd15c83","type":"change","z":"3086e47410af607f","name":"","rules":[{"t":"set","p":"recipient","pt":"msg","to":"Dad","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":160,"wires":[["7baf9ee4643e4171"]]},{"id":"898ae5f530a41476","type":"change","z":"3086e47410af607f","name":"","rules":[{"t":"set","p":"recipient","pt":"msg","to":"Mom","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":280,"wires":[["cca66198d9d467b1"]]},{"id":"cca66198d9d467b1","type":"debug","z":"3086e47410af607f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":280,"wires":[]}]

Does this flow provide what you are aiming for?

[{"id":"b2b2c3628bb65d20","type":"inject","z":"3086e47410af607f","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"3","topic":"","payload":"Server unavailable","payloadType":"str","x":150,"y":80,"wires":[["542cb60982562a56"]]},{"id":"11233d047dedc706","type":"inject","z":"3086e47410af607f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Server available","payloadType":"str","x":140,"y":120,"wires":[["542cb60982562a56"]]},{"id":"55c2988aac1b456b","type":"rbe","z":"3086e47410af607f","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":370,"y":100,"wires":[["98d7d2b3956c8a6c","4683a60bd6e49150"]]},{"id":"98d7d2b3956c8a6c","type":"trigger","z":"3086e47410af607f","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"Server available","bytopic":"all","topic":"topic","outputs":1,"x":560,"y":220,"wires":[["52ff2f87395ec97b"]]},{"id":"160b59194dda993d","type":"debug","z":"3086e47410af607f","name":"Message to Dad","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":120,"wires":[]},{"id":"fcf322f8e712ce77","type":"comment","z":"3086e47410af607f","name":"Simulated input messages","info":"","x":150,"y":40,"wires":[]},{"id":"78fb6010bf9ea758","type":"comment","z":"3086e47410af607f","name":"Block duplicates","info":"","x":400,"y":60,"wires":[]},{"id":"9cce780e0d8b557a","type":"debug","z":"3086e47410af607f","name":"Message to Mom","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":80,"wires":[]},{"id":"491613437fb03450","type":"debug","z":"3086e47410af607f","name":"Message to Dad","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":240,"wires":[]},{"id":"7fbc155a0155a613","type":"debug","z":"3086e47410af607f","name":"Message to Mom","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":200,"wires":[]},{"id":"d747d7fd24cbf205","type":"comment","z":"3086e47410af607f","name":"Resend after 5 minutes unless \"Server available\"","info":"","x":680,"y":160,"wires":[]},{"id":"542cb60982562a56","type":"junction","z":"3086e47410af607f","x":280,"y":100,"wires":[["55c2988aac1b456b"]]},{"id":"4683a60bd6e49150","type":"junction","z":"3086e47410af607f","x":680,"y":100,"wires":[["160b59194dda993d","9cce780e0d8b557a"]]},{"id":"52ff2f87395ec97b","type":"junction","z":"3086e47410af607f","x":680,"y":220,"wires":[["491613437fb03450","7fbc155a0155a613"]]}]

(I have changed the delay from 5m to 5s for convenience)

Just move your function after the rate limiting and it will send 2 messages every 5 mins.

[{"id":"b2b2c3628bb65d20","type":"inject","z":"3086e47410af607f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":210,"y":200,"wires":[["69a2808014af0b46"]]},{"id":"69a2808014af0b46","type":"delay","z":"3086e47410af607f","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":400,"y":200,"wires":[["2a1be6e2687cba71"]]},{"id":"7baf9ee4643e4171","type":"debug","z":"3086e47410af607f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":200,"wires":[]},{"id":"2a1be6e2687cba71","type":"function","z":"3086e47410af607f","name":"","func":"msg.recipient = \"Dad\";\nnode.send(msg);\nmsg.recipient = \"Mom\";\nnode.send(msg);\n\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":200,"wires":[["7baf9ee4643e4171"]]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.