Skip to content

[Feature Request] Expose Clean Start and Session Expiry Interval in the MQTT Integration configuration so the built-in bridge can create persistent sessions #268

Description

@sparky369

TBMQ’s Integration UI for MQTT does not currently expose Clean Start or Session Expiry Interval settings, and the implementation does not set them, so defaults result in non-persistent sessions for the client.

Problem description:

I would like to deploy an edge mqtt broker (TBMQ) cluster and a cloud mqtt broker (TBMQ) cluster and create a bridge between them so that the edge mqtt broker can forward data to the cloud mqtt broker when there is a network (internet) connectivity between the edge mqtt broker and the cloud mqtt broker.

To deploy the edge MQTT broker (TBMQ) cluster, I have created an EC2 instance (AMI: Ubuntu Server 24.04 LTS (HVM), Instance type: t3.xlarge). The subnet ID is subnet-0be115ba12ed27b6a (Availability Zone: eu-north-1a). I have deployed the TBMQ in cluster mode using the following way.
(i) I installed docker and docker compose.
(ii) I cloned the official latest github repository of TBMQ.
git clone https://github.com/thingsboard/tbmq.git
(iii) Then, I changed the directory to tbmq/docker, which contains scripts and Docker Compose configurations to run TBMQ in cluster mode.
(iv) I executed the following command to create volumes for the services:
./scripts/docker-create-volumes.sh
(v) Then, I executed the following command to run installation:
./scripts/docker-install-tbmq.sh
(vi) Then, I executed the following command to start services:
./scripts/docker-start-services.sh
(vii) The created docker containers are: 1 container for haproxy-certbot, 2 containers for 2 tbmq nodes, 2 containers for 2 tbmq integration executor, 1 container for kafka, 1 container for postgresql, and 1 container for valkey.
(viii) After a while when all services successfully started, I can make requests to http://edge-ip in my browser and connect clients using MQTT protocol on 1883 port.

To deploy the cloud MQTT broker (TBMQ) cluster, I have created another EC2 instance (AMI: Ubuntu Server 24.04 LTS (HVM), Instance type: t3.xlarge). The subnet ID is subnet-057368c2acb4904a2 (Availability Zone: eu-north-1b). I have deployed the TBMQ in cluster mode using the following way.
(i) I installed docker and docker compose.
(ii) I cloned the official latest github repository of TBMQ.
git clone https://github.com/thingsboard/tbmq.git
(iii) Then, I changed the directory to tbmq/docker, which contains scripts and Docker Compose configurations to run TBMQ in cluster mode.
(iv) I executed the following command to create volumes for the services:
./scripts/docker-create-volumes.sh
(v) Then, I executed the following command to run installation:
./scripts/docker-install-tbmq.sh
(vi) Then, I executed the following command to start services:
./scripts/docker-start-services.sh
(vii) The created docker containers are: 1 container for haproxy-certbot, 2 containers for 2 tbmq nodes, 2 containers for 2 tbmq integration executor, 1 container for kafka, 1 container for postgresql, and 1 container for valkey.
(viii) After a while when all services successfully started, I can make requests to http://cloud-ip in my browser and connect clients using MQTT protocol on 1883 port.

To configure the bridge between TBMQ Edge→TBMQ Cloud, I used TBMQ UI as follows.:
(i) Open http://edge-ip
Use the following default credentials for System Administrator:
Username: sysadmin@thingsboard.org, Password: sysadmin
On http://edge-ip/home, disable Basic Authentication from Broker Settings.
(ii) Then go to Integrations → Add Integration (+) → Type: MQTT, Name: MQTT Integration,
Tick Enable Integration, Click Next,
Add topic filters:
edge/sensors/#
edge/inference/#
Click Next,
Host: cloud-ip, Port: 1883,
Tick Dynamic Topic Name,
Client ID: tbmq_edge_client,
Credentials type: Anonymous,
Keep Alive (sec): 60,
Connect timeout (sec): 10,
Reconnect period (sec): 5,
MQTT Version: MQTT 5,
Tick Dynamic QoS,
Tick Dynamic Retain,
Click check connection. The status shows Connected. Then click Add.

Open http://cloud-ip
Use the following default credentials for System Administrator:
Username: sysadmin@thingsboard.org, Password: sysadmin
On http://cloud-ip/sessions, tbmq_edge_client appears. If I cllick on tbmq_edge_client, I can see Clean Start is enabled. It means this session is not persistent. All info and messages from previous persistent session will be lost after disconnection. I want to disable Clean Start. However, I can not disable it as the field is grayed and not clickable.

I also checked http://edge-ip/home to find if there is any way to disable Clean Start. However, I could not find anything.

Image

Metadata

Metadata

Labels

EnhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions