Duplicate flow multiple times

Hi All,

I have written a flow (attached is a shorter flow than mine, but it is the same) and I would like to duplicate this flow N times, at the request of the user I receive from the HTTP request node. Since I have a TCP node in the flow (Each flow simulates a device that has its own messages and communication line), I can't use a loop node, so I have to duplicate the whole flow (At least from the TCP node until the end of the flow).

I would like to know if there is a process or node that can help me with this issue.

Thanks for your help!

If the processing is the same for each input, you shouldn't need to duplicate the flow but rather allow for different ID's or whatever changes.

Hi, thanks for the quick reply.
Yes the flow is the same but I didn't understand what your meaning with ID is different?
I need different flow for each device, In order to avoid mixing up messages between devices..

Sorry, shorthand.

I'm assuming that you have some kind of data that identifies the differences between the devices? If not, one can be added artificially when the data comes in so that at least you only have to duplicate the starting node and a change node that adds the id.

After that, the rest of the code should be the same right? So you don't need to duplicate it, simply make use of the identifier when you need to.

thanks now i understand but the problem with that it's that i need different tcp node for each device.
i try to edit the sorce code of the tcp node and I succeeded, every time I send a specific message a new socket opens .. but after that the TCP does not know which message belongs to which socket... And I return to the idea of ​​duplication of the all flow..

Yes, you need a way to identify each device otherwise you can't really process them. If you can't get the devices to send an identifier, perhaps get them to connect to a different TCP port so that you can have 1 for each device.

Even better would be to update the devices to get them to write to MQTT where you would have a topic that is unique to each device and therefore you would only need a single MQTT-in node and could process accordingly.

The problem is deeper... Even if I have a message ID, I have a trigger node that sends reports and every time a new device connects it stops the reports of the previous device.

In addition my reciver work only with TCP, so MQTT it's not an option but thanks.

You can set the Handling field in the trigger node to Each and specify a msg property that identifies the ID. Then the trigger node will handle each ID separately in parallel.

1 Like

Ok, i will try it, thanks!