Sub Flow Context Variables - via. http - are not unique

Hi Everyone

I am aware that each sub flow instance is self contained container so its context variables are unique it. I have tested this and it works.

I have a strange challenge.

I connected a http in node to a subflow.

Within subflow i go flow.set("TESTVAL2","LEMON"). (pseudo code)

What i find is on subsequent calls of http request the flow context variable persists.

Is this the expected behavior ? as i would assume each instance of subflow - even if via. http will be unique.

Or am i not understanding something here.

Here is the calling flow :

And the subflow itself :

Each http request is being passed to the same instance of the subflow, so is accessing the same flow context.

Thanks Nick.
I managed to circumvent my current issue (we removed the use of flow context variable as it could be avoided).

But logically would it be correct ? Shouldn't each http request be an independent e2e run ?
I am myself not sure. Both sides of arguments have merits.

Yes, they both have merits, but Node-RED doesn't do per-message context. If you want to associate state with an individual message, attach it to the message.

This is what i did eventually cos i did not absolutely really need that context .
Thanks . I have sorted this for now.

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