# Developing external connectivity nodes

**URL:** https://discourse.nodered.org/t/developing-external-connectivity-nodes/54590
**Category:** Developing Nodes
**Created:** [1 December 2021 16:55 UTC](https://discourse.nodered.org/t/developing-external-connectivity-nodes/54590 "2021-12-01T16:55:46Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![cloud-rocket](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cloud-rocket/32/48745_2.png) [@cloud-rocket](https://discourse.nodered.org/u/cloud-rocket)
#### Post date: [1 December 2021 16:55 UTC](https://discourse.nodered.org/t/developing-external-connectivity-nodes/54590/1 "2021-12-01T16:55:46Z")

</div>

Hi,

I am developing custom connectivity nodes (database, AMQP and etc.). I am still struggling to understand what should be the best approach to connections reuse.

All of the packages I looked into are using "config" nodes just for config store and every (UI) node instance maintains its own connection to the external system. This sounds strange to me, since Node-Red is running in a single process, and it should not be an issue to store the connection object in the config node and reuse this connection across other (UI) nodes. This approach should be a lot more resource savvy (i.e. DB connection is considered to be highly resource-intensive on DB server).

Your thoughts are highly welcomed.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [1 December 2021 17:09 UTC](https://discourse.nodered.org/t/developing-external-connectivity-nodes/54590/2 "2021-12-01T17:09:38Z")

</div>

It depends on the specific service, but I would say the expected design for something that maintains a long running connection would be to maintain a single connection in the config node and pool the connection between the flow nodes.

The core MQTT nodes do just that - the config node does the work to maintain the connection.

There may be some services where that doesn't make as much sense - where the interaction specifics make it harder to route a response back from that service to the right flow node that's sharing the connection. In those cases, each flow node needs to have its own connection. But I would consider that the exception rather than the rule.

---

<div class="post-metadata">

### Author: ![cloud-rocket](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cloud-rocket/32/48745_2.png) [@cloud-rocket](https://discourse.nodered.org/u/cloud-rocket)
#### Post date: [1 December 2021 17:11 UTC](https://discourse.nodered.org/t/developing-external-connectivity-nodes/54590/3 "2021-12-01T17:11:10Z")

</div>

Thanks!

This is exactly what I thought.

---

<div class="post-metadata">

### Author: ![cloud-rocket](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cloud-rocket/32/48745_2.png) [@cloud-rocket](https://discourse.nodered.org/u/cloud-rocket)
#### Post date: [1 December 2021 18:01 UTC](https://discourse.nodered.org/t/developing-external-connectivity-nodes/54590/4 "2021-12-01T18:01:31Z")

</div>

@knolleary,

In this case, when the config node holds the connection object. The dependent nodes need to wait until a connection is established. What is the correct approach to implement this waiting mechanism?

Thanks

---

<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 January 2022 18:02 UTC](https://discourse.nodered.org/t/developing-external-connectivity-nodes/54590/5 "2022-01-30T18:02:05Z")

</div>

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