# Force LWT when a failure occurs

**URL:** <https://discourse.nodered.org/t/force-lwt-when-a-failure-occurs/36717>\
**Category:** General\
**Created:** [29 November 2020 15:04 UTC](https://discourse.nodered.org/t/force-lwt-when-a-failure-occurs/36717 "2020-11-29T15:04:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![garybia](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@garybia](https://discourse.nodered.org/u/garybia)\
**Post date:** [29 November 2020 15:04 UTC](https://discourse.nodered.org/t/force-lwt-when-a-failure-occurs/36717/1 "2020-11-29T15:04:35Z")

</div>

I have node-red connected to a server (via TCP) that is providing data for several measurement points. Node-red is responsible for translating the data from the server into an MQTT message and sending this to a MQTT server. The server will at some point fail and node-red can get a failure of the TCP link (or at least I think the the catch will get it). When that happens I want to be able to tell the MQTT broker to send LWT messages. Is there a way to tell the MQTT out node to fail?

---

<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:** [29 November 2020 15:53 UTC](https://discourse.nodered.org/t/force-lwt-when-a-failure-occurs/36717/2 "2020-11-29T15:53:15Z")

</div>

Welcome to the forum @garybia

There is nothing to stop you sending whatever message you have configured LWT for at any time you like.

---

<div class="post-metadata">

**Author:** ![garybia](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@garybia](https://discourse.nodered.org/u/garybia)\
**Post date:** [29 November 2020 17:03 UTC](https://discourse.nodered.org/t/force-lwt-when-a-failure-occurs/36717/3 "2020-11-29T17:03:57Z")

</div>

Thanks Colin. Was kind of a "duh?" moment I guess. That saves me configuring a last will for each end point which I was trying to avoid.

---

<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:** [28 January 2021 17:04 UTC](https://discourse.nodered.org/t/force-lwt-when-a-failure-occurs/36717/4 "2021-01-28T17:04:14Z")

</div>

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