Configure MQTT by using protocol extensions

The following steps add a MQTT protocol to the NetScaler appliance.

Import the extension file to the NetScaler appliance, from either a web server (using HTTP) or your local workstation. For details about importing the extension file, see Import extensions.

import ns extension local:mqtt_generic_fs.lua mqtt_code

Add a new user TCP based protocol to the system by using the extension.

add user protocol MQTT -transport TCP -extension mqtt_code

Add a service of type USER_TCP to indicate that this is a user-defined protocol.

add service s1 10.102.90.112 USER_TCP 80

Add a user load balancing vserver and bind backend services to it.

add lb vs mysv USER_TCP

bind lb vs mysv s1

Add a user virtual server for the newly added protocol and make the load balancing virtual server configured in the previous step the default load balancer.

add user vs v_mqtt MQTT 10.217.24.28 80 -defaultlb mysv

Optionally, enable MQTT session persistence based on ClientID, set the persistence type to USERSESSION.

set lb vserver mysv -persistenceType USERSESSION

Configure MQTT by using protocol extensions