# Stop inject message

**URL:** <https://discourse.nodered.org/t/stop-inject-message/44848>\
**Category:** General\
**Created:** [28 April 2021 08:55 UTC](https://discourse.nodered.org/t/stop-inject-message/44848 "2021-04-28T08:55:44Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 April 2021 09:22 UTC](https://discourse.nodered.org/t/stop-inject-message/44848/3 "2021-04-28T09:22:05Z")

</div>

you can easily achieve this with a function node...

![QaWHgFcxqx](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/f/7f569845ee88b893b9af06722a9178c1d6c6162d.gif)

Demo flow

```auto
[{"id":"fb21b077.e82d8","type":"inject","z":"59c1e9ca.dd6988","name":"every 15m","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"0.5","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":630,"y":940,"wires":[["9c7b3790.838ae8"]]},{"id":"f8cb95c9.09e8f8","type":"debug","z":"59c1e9ca.dd6988","name":"to message sender","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1050,"y":940,"wires":[]},{"id":"9c7b3790.838ae8","type":"function","z":"59c1e9ca.dd6988","name":"block/unblock","func":"var block = context.get(\"block\") || false;\n\nif (msg.topic == \"block\") {\n block = true;\n node.status({fill:\"red\",shape:\"ring\",text:\"blocked\"});\n} else if (msg.topic == \"unblock\") {\n block = false;\n node.status({});//clear status\n}\n\ncontext.set(\"block\", block);\n\nif(block) return null; //halt the flow\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":940,"wires":[["f8cb95c9.09e8f8"]]},{"id":"55a14164.9d978","type":"inject","z":"59c1e9ca.dd6988","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"block","payload":"","payloadType":"str","x":610,"y":1000,"wires":[["9c7b3790.838ae8"]]},{"id":"a1cef437.a22018","type":"inject","z":"59c1e9ca.dd6988","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"unblock","payload":"","payloadType":"str","x":620,"y":1040,"wires":[["9c7b3790.838ae8"]]}]

```

---

_[View the full topic](https://discourse.nodered.org/t/stop-inject-message/44848)._
