# Stop / Abort / Kill a SubFlow

**URL:** <https://discourse.nodered.org/t/stop-abort-kill-a-subflow/43427>\
**Category:** General\
**Created:** [30 March 2021 22:55 UTC](https://discourse.nodered.org/t/stop-abort-kill-a-subflow/43427 "2021-03-30T22:55:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulkeates](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paulkeates](https://discourse.nodered.org/u/paulkeates)\
**Post date:** [30 March 2021 22:55 UTC](https://discourse.nodered.org/t/stop-abort-kill-a-subflow/43427/1 "2021-03-30T22:55:20Z")

</div>

Hi,

I'm probably missing something obvious but... Is there a way to force a **SubFlow** that is processing an asynchronous task that might take a minute or two to complete to immediately stop?

I feel it might be complicated or 'bad' to have (for example) multiple polling points within each SubFlow checking a global variable.

Thoughts welcomed!

Cheers,  
Paul

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [31 March 2021 07:38 UTC](https://discourse.nodered.org/t/stop-abort-kill-a-subflow/43427/2 "2021-03-31T07:38:42Z")

</div>

Hi.

Ok, my take:

Subflows are limited to one input.

But what happens inside is another story.

Just inside the subflow, test if the _message_ has a specific topic.  
If it doesn't go to the existing nodes.

If it does have that topic, then signal the other nodes in the subflow to stop.

 ![Screenshot from 2021-03-31 18-37-15](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/6/a69a220c61f20b042e9e7cf2d3bb440dad4b6d25.png)

That is kind of what I mean.

Understand what I mean?

---

<div class="post-metadata">

**Author:** ![paulkeates](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paulkeates](https://discourse.nodered.org/u/paulkeates)\
**Post date:** [31 March 2021 15:10 UTC](https://discourse.nodered.org/t/stop-abort-kill-a-subflow/43427/3 "2021-03-31T15:10:52Z")

</div>

Hi Trying\_to\_learn,

That was pretty much the only way I could see to terminate SubFlows as well. Poll / check a variable periodically while inside the SubFlow (Switch node) and, if the conditions are met, jump somewhere else. The negative of this is the need to periodically check...

Any other process or method would be appreciated!

Cheers,  
Paul

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 March 2021 15:24 UTC](https://discourse.nodered.org/t/stop-abort-kill-a-subflow/43427/4 "2021-03-31T15:24:46Z")

</div>

That isn't what @Trying_to_learn was suggesting. Send in a message with a specific topic and in the subflow use that message to stop your process. No polling or variables required.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 May 2021 15:25 UTC](https://discourse.nodered.org/t/stop-abort-kill-a-subflow/43427/5 "2021-05-30T15:25:48Z")

</div>

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