• V
 

减慢通过流传递的消息

问题

您想减慢通过流传递的消息。例如,您有一个包含值数组的消息,您 将其拆分为消息流,并希望以每秒一个的速度处理 该流中的每条消息。

解决方案

使用配置为限制通过它的消息速率的 Delay 节点。

示例

[{"id":"1fccc223.7ba87e","type":"inject","z":"ac14500e.2c57d","name":"注入数组","topic":"","payload":"[0,1,2,3,4,5,6,7,8,9]","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1280,"wires":[["b2837466.e02a38"]]},{"id":"b2837466.e02a38","type":"split","z":"ac14500e.2c57d","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":250,"y":1280,"wires":[["bd97c8ed.a5c8d8"]]},{"id":"bd97c8ed.a5c8d8","type":"delay","z":"ac14500e.2c57d","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":1280,"wires":[["bd66f03e.bdf0c"]]},{"id":"bd66f03e.bdf0c","type":"debug","z":"ac14500e.2c57d","name":"调试","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":530,"y":1280,"wires":[]}]

讨论

Delay 节点的速率限制模式可用于 更改通过它的消息速率。它配置为每个时间间隔通过节点的所需消息数量。它将均匀地 在时间段内分配消息的发送。