Link Call Node #64
Replies: 4 comments 11 replies
-
Could the link out node not auto detect the _linksource property ? So the user didn’t have to select that mode. It also assumes that no nodes in the linked segment create new msgs and drop that property. Could the link out node flag an error if a message arrives and it’s output is not wired and the _linksource is missing ? |
Beta Was this translation helpful? Give feedback.
-
Some thoughts... Will the link out node, when set for return mode hide it's output pin? Should the special property be removed from the msg before it's returned to the link call node (to clean up the msg / prevent round trips)? |
Beta Was this translation helpful? Give feedback.
-
Well, I'm a complete beginner with respect to node implementation and may therefore be completely wrong with my thoughts but... ...is it wise to use a property (namely Let me illustrate. Right now
With the extension
What if
Node-RED is a visual development environment. How do you visualize that a Wouldn't it be wiser to implement a completely new node triple (namely Again, I'm completely new and may thus be completely wrong - if so, please accept my apologies for having disturbed you! |
Beta Was this translation helpful? Give feedback.
-
Having implement this design and played with it, I'm coming to the conclusion it will be better to have a separate The issues with overloading the
|
Beta Was this translation helpful? Give feedback.
-
Ref https://trello.com/c/4UkvoNM1/199-link-add-link-call-node
The Link nodes can be used to add virtual links between different flows. That's useful if there is a common flow you want to be able to call from multiple places.
But you can't used them to create a 'subroutine' flow that can be called from other flows and have the result returned to the calling flow. (In theory, that's what subflows are for - but they also have their drawbacks.)
This design proposal covers how the link nodes could be extended to support the call-and-return mode of operation.
There are two parts to this design - a new node in the palette and a new option in the
link out
node.link-call
nodeThis is a regular flow node with an input and output. Its configuration lets you pick a
Link In
node as its destination. When it receives a message it passes it to the Link In node.Before passing the message on, it sets
msg._linkSource
(better name needed...) to an array containing the node'sid
. Ifmsg._linkSource
already exists, it pushes itsid
to the end of the array. This will allow for flows that make nested calls.link out
'return' modeThe
link out
node gets a new option to put it intoreturn
mode. In that mode, if it receives a message withmsg._linkSource
set, it gets the last entry from themsg._linkSource
array, gets the corresponding link-call node and passes it the message directly. It will do this using a private API between thelink out
andlink-call
nodes - allowing thelink-call
node to send that message on as normal. This has the downside of bypassing the pluggable message routing layer, but as it will only ever be returning the message to one caller, the message won't need cloning.Beta Was this translation helpful? Give feedback.
All reactions