---
title: Set Up Edge Cascading with the NATS Connector
slug: manufacturing-connect-edge/set-up-edge-cascading-with-the-nats-connector
docTags: 
createdAt: 2022-11-07T17:52:19.000Z
---

Review the following guide for setting up Edge Cascading, which is an integration of multiple Manufacturing Connect Edge instances with a NATS connector.&#x20;

# Before You Begin

- Ensure that every Manufacturing Connect Edge instance that will be used to set up the NATS Proxy connection is on version 3.3.1 or newer.&#x20;
- Determine which Manufacturing Connect Edge instance(s) will be the NATS server (host the API access account), and which Manufacturing Connect Edge instance(s) will be the NATS client (host the NATS connector). The NATS server and the NATS client can both send and receive the data going through the NATS proxy connection.&#x20;
- If your network has a firewall, make sure it allows port 4222.&#x20;

# Use Case: Set up Edge Cascading with One NATS Client and One NATS Server

Review the following use case to set up two Manufacturing Connect Edge instances with Edge Cascading. Manufacturing Connect Edge A (Server) is the NATS Server and Manufacturing Connect Edge B (Client) is the NATS Client. You will be able to view data from the NATS Server.&#x20;

## Step 1: Enable NATS Proxy (NATS Server)

You will need to enable the NATS Proxy connection in Manufacturing Connect Edge A (Server). The connection is disabled by default.&#x20;

**To enable NATS Proxy:**

1. In Manufacturing Connect Edge A (Server), navigate to **System&#x20;***>&#x20;***Tokens**.&#x20;
2. In the *NATS Proxy* section, click the **Disabled&#x20;**&#x74;oggle to **Enabled**.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/dhrt3rNSjKJ8Mh8htiWPq_image.png" size="80" width="1197" height="469" caption="Enable/Disable toggle for NATS Proxy" position="center" showCaption="true"}

## Step 2: Create and Configure Access Account (NATS Server)

You will now need to enable a NATS server. To do this, you will need to create an access account. Once you create the account, copy the API key that you will use to set up the NATS integration connector.&#x20;

**To create the access account:**

1. From Manufacturing Connect Edge A (Server), navigate to **System&#x20;***>&#x20;***Tokens**.&#x20;
2. From the *Access Accounts* section, click the **Add&#x20;**&#x69;con.
   The *Create API Account&#x20;*&#x64;ialog box appears.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/gn-LWEb4IM3TArvUHkhC1_addaccessaccount.png" size="80" width="1198" height="795" caption="Add Access Account icon" position="center" showCaption="true"}
3. Enter a name for the account and ensure the *Enable Account&#x20;*&#x63;heckbox is selected.&#x20;
4. Click **Create Account**.&#x20;
5. Click the **Action menu** for the account you just created and select **Edit topics**.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/eDI-FYotU9sTXLJBa6ASy_edittopics.png" size="80" width="996" height="436" caption="Edit topics option" position="center" showCaption="true"}
6. In the **Read Topics** field, enter the relevant NATS topics and click **Add Read Topic** for each one. Ensure that you follow proper NATS topics conventions for topic names. By default, a wildcard topic is created (`>`). This topic will read all topics.
7. In the **Write Topics** field, enter the relevant NATS topics and clic&#x6B;**&#x20;Add Write Topic** for each one. Ensure that you follow proper NATS topics conventions for topic names. To create a wildcard topic, enter `>` for the topic name.&#x20;
8. When done entering read and write topics, click **Update**.&#x20;
9. Click the **Action menu** again for the account and select **View API Key**.&#x20;
10. Click the **Copy&#x20;**&#x69;con for the API key and paste it somewhere so you can access it later.&#x20;
    ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/zQBCvvbN5la_Tn7SFdZ_x_copyapi.png" size="80" width="778" height="229" caption="Copy API Key icon" position="center" showCaption="true"}

## Step 3: Create NATS Integration Connector (NATS Client)

You will now have to set up the NATS Client by creating a NATS integration connector. &#x20;

**To create the NATS Integration Connector:**

1. From Manufacturing Connect Edge B (Client), navigate to **Integration***.&#x20;*
2. Click the **Add a connector&#x20;**&#x69;con.
   The *Add a connector* dialog box appears.&#x20;
3. Use the *Provider&#x20;*&#x64;rop-down list to select the **NATS&#x20;**&#x63;onnector.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/iF05MAkJ-FOiAV9HWw7gI_natsconnector.png" size="80" width="1171" height="358" caption="NATS connector" position="center" showCaption="true"}
4. &#x20;Enter the details for the connector.&#x20;
   - **Name**: Enter a name for the connector.&#x20;
   - **Hostname**: Copy the URL of the Manufacturing Connect Edge instance with the NATS server and the access account you previously created. For example, if the URL of the instance with the NATS server is https\://192.168.0.175, enter **192.168.0.175**.&#x20;
   - **Port**: Verify the default port is correct and make any necessary changes.&#x20;
   - **NATS Username**: You can leave the field blank.&#x20;
   - **NATS Password**: This field is required. Paste the API key you copied from the access account you previously created.&#x20;
   - **Default topic name**: Enter a default topic name. The default topic name does not need to have data and does not need to present in all systems sending/receiving data. It can also be  overwritten. It will be used later to view the data from the NATS connection.&#x20;
   - **Enable TLS secure connection**: Make sure the check box is selected. This allows the connector to successfully connect with the NATS server.&#x20;
   - **Insecure skip verify**: Make sure the check box is selected. This allows for a successful connection with a NATS server that may have a self-signed certificate that is not formally recognized by a certificate authority.&#x20;
   - **Throttling limit**: You have an option to enter a throttling limit.&#x20;
   - **Persistent storage**: You have the option of selecting this option. When enabled, this will cause messages to undergo a store-and-forward procedure. Messages will be stored within Manufacturing Connect Edge when cloud providers are online. &#x20;
   - **Queue Mode**: Select the queue mode as **lifo&#x20;**(last in first out) or **fifo&#x20;**(first in first out). Selecting **lifo** means that the last data entry is processed first, and selecting **fifo&#x20;**&#x6D;eans the first data entry is processed first.&#x20;
5. Click **Add**.&#x20;

## Step 4: Enable the Connector

After adding the connector, click the toggle in the connector tile to enable it.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/ey9TtVDK1EBo7H96leWgT_nats.png" size="60" width="415" height="347" position="center" showCaption="false"}

If you see a *Failed&#x20;*&#x73;tatus, you can review the [Connector Logs](docId\:Zz28hZtQBK7oD_Xsj81O8) and relevant error messages.&#x20;

## Step 5: Add Device

Now that you've set up the connection between the NATS Server and NATS Client, you can create the DeviceHub device that will store the tags that will be used to create topics for the NATS connector.&#x20;

From Manufacturing Connect Edge B (Client), follow the steps to [Connect a Device](docId\:nm1lQfefyA-DSIfFitIty).&#x20;

Make the following configurations:

- Select Device Type **Simulator&#x20;**&#x61;nd Driver Name **Generator**. You have the option of setting up a different device to your specific requirements.&#x20;

## Step 6: Add Tags

After connecting the device, you can [Add a Tag](docId\:h5heqIcXrCY3NCH9KBg9I) to the device. The tags will be used to create topics in the NATS connector.&#x20;

## Step 7: Create Topics for Connector

You will need to create topics in the NATS connector you created.&#x20;

**To create connector topics:**

1. From Manufacturing Connect Edge B (Client), navigate to **Integration**.&#x20;
2. Click the NATS connector tile.&#x20;
   The connector *Dashboard&#x20;*&#x64;isplays.&#x20;
3. Click the **Topics&#x20;**&#x74;ab.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/t9YxXauocOS-HuAV-6jLQ_topicstabmce.png" size="80" width="764" height="489" caption="Topics tab" position="center" showCaption="true"}
4. Click the **Import from DeviceHub** tags icon.&#x20;
   The DeviceHub Import dialog box appears.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/i7swEa_qwHfadoB_LAjES_importfromdevicehubmce.png" size="80" width="899" height="416" caption="Import from DeviceHub tags icon" position="center" showCaption="true"}
5. Select the check box to import all tags from the device you created earlier and click **Import**.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/rDMkLfC0RfpjI2sOPz88q_select-all-tags.png" size="80" width="973" height="283" caption="DeviceHub Import dialog box" position="center" showCaption="true"}
6. Click the **Enable all topics** icon.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/xi4tA3nbMfKUSPYvMYCn5_enablealltopicsmce.png" size="80" width="1244" height="459" caption="Enable all topics icon" position="center" showCaption="true"}
7. Return to the Integration pane and toggle the connect option to enable the connection between the connector and the NATS server.&#x20;
8. If the tile status shows CONNECTED, the connection was successfully set up.

## Step 8: View Data

Once the connection is successfully set up, you can use the [Flows Manager](docId\:q4JyT-_6f9wEAqu53lw3b) or [Analytics](docId\:dXCE9032oQIlIGIMolvlm) in the NATS Server to view data from the connection.&#x20;

### Before You Begin

You will need to use the default topic name you configured for the NATS connector in the NATS Client. Click the **Edit** icon for the NATS connector tile and copy the default topic name.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/vNGj5iTv5n-mJgBmaH6fC_image.png" size="80" width="1163" height="482" caption="Default topic name" position="center" showCaption="true"}

### View Data in Flows Manager

You can create a flow to view data from the connector topics.&#x20;

**To view data from the Flows Manager:**

1. From Manufacturing Connect Edge A (Server), navigate to **Flows Manager**.&#x20;
2. Navigate to the Flows Manager and create a new flow. See [Create a Flow](docId\:VeeOD3N3SLCAsdLEedZBr) to learn more.&#x20;
3. On the flow canvas, drag the **Datahub Subscribe** node and **debug&#x20;**&#x6E;ode onto the canvas. Then, connect the two nodes.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/7CHgVLn3EpkwH-VMrw-d4_nodes.png" size="80" width="870" height="494" caption="The DataHub Subscribe and Debug nodes" position="center" showCaption="true"}
4. Double-click the **DataHub Subscribe** node.
   The *Edit DataHub Subscribe node* dialog box appears.
   - In the **Topic&#x20;**&#x66;ield, paste the default topic name for the NATS connector.
   - If needed, configure the Datahub Subscribe connection. See the *Step 3: Configure Connector Nodes* section in [Create a Flow](docId\:VeeOD3N3SLCAsdLEedZBr) to learn more.&#x20;
   - Click **Done**, and then click **Deploy**.&#x20;
5. Expand the message window beneath the flow to view debug messages.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/lz-qs1cWlGXGmyB37FgSn_expand-message-window.png" size="80" width="1294" height="858" caption="The message window" position="center" showCaption="true"}
6. Click the **Debug&#x20;**&#x69;con.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/VcYhsouq_alRxhjvziSnG_debug-icon.png" size="80" width="1317" height="858" caption="The Debug icon" position="center" showCaption="true"}
7. Confirm the **Debug&#x20;**&#x6E;ode is activated and review the messages in the debug window. The `"success" :true` message confirms the connection is successful.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/Pg_kBERO2UuS39IdohRiG_success-messages.png" size="80" width="1317" height="858" caption="Review messages" position="center" showCaption="true"}

### View Data in Analytics

You can view data by using the Analytics canvas.&#x20;

**To view data in Analytics:**

1. From Manufacturing Connect Edge A (Server), navigate to **Analytics**.
2. Click **Add Processor** and select **DataHub Subscribe**.&#x20;
3. In the **Topic&#x20;**&#x66;ield, paste the default topic name for the NATS connector.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/YVK2-K2-dRNFMKGIUiGM8_analytics-topic.png" size="80" width="778" height="397" caption="Topic name" position="center" showCaption="true"}
4. Click **Save**.&#x20;
5. Click the **View&#x20;**&#x69;con.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/iTDXCLIN5ZEwIFoXjzPLq_view-iconmce.png" size="78" width="647" height="415" position="center" showCaption="false"}
6. Review the *Instance Messages*. The `"success" :true` message confirms the connection is successful.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/GFluZx5gTmtCqNsk7CpPn_analytics-messagesmce.png" size="80" width="1110" height="715" caption="Instance Messages" position="center" showCaption="true"}

