Parallel run of Subflows

Hello,

i'm trying to handle with messages that comes in parallel to subflow.
Here is exmaple
image
4 messages comes at same time to one subflow.
I would like to make a delay for messages. For example 1 messag in 3 sec.
image


But in this case all the messages comes output of sublow at the same time without any delay

Please advice how do realise it?

Thanks a lot!

At the moment, you have four separate instances of the subflow. That is not the same thing as having one instance of the subflow handling multiple messages.

1 Like

How to change the to one?

Each time you drag a copy of the subflow into the workspace you are creating a new instance of the subflow.

If you only want one, then you should only have one subflow instance in your workspace.

1 Like

If it is not possible? No way to solve it? The messages comes from different flows...

It sounds like you want to have a flow that is called from multiple places.

One option would be to use Link nodes to pass messages from your different flows to the flow you want to handle the messages - and not to use Subflows which aren't designed for this scenario.

1 Like

Yes, you are right - like function. To make a queue for TTS Speaker.
You mean these Link nodes?
image
?It is like a shortcut for sublow?

Yes, those are the link nodes I am referring to.

This guide explains the differences between subflows and link nodes - https://nodered.org/docs/developing-flows/flow-structure#making-reusable-flows

1 Like

Thanks a lot!
Will try now!

Also maybe see https://flows.nodered.org/flow/cea8afa28b7a93ebdc0f
Not a subflow but a simple queue for TTS example

1 Like

Thanks i use exactly it! But as i said the problem was in multipy instances

When you have multiple instances of a subflow then each delay node is a separate node, so each one limits the rate of output of messages passing through it, but as each one node sees only one message then the delay nodes have no effect.

What are you actually trying to achieve with multiple instances of the same subflow being given the same messages?

1 Like

Thanks, already solved with Link Node. See above

It works for me realy perfeсt! Thanks one more time!
Now i got other but much smaller problem. As i understood Links do not works with Subflows, when i set Link unside Subflow it do not link. Is there a way to solve it?

You can use links within a subflow. You can't link into a subflow of course, because node-red wouldn't know which instance of the subflow you wanted to link into, and if you want to link out of a subflow then you can use an additional output instead.

Thanks!
I made it this way, with output, works like a charm!

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