ltm rule command MQTT client idΒΆ

iRule(1)					  BIG-IP TMSH Manual					     iRule(1)

MQTT::client_id
       Get or set client identifier of MQTT CONNECT message

SYNOPSIS
       MQTT::client_id (CLIENTID)?

DESCRIPTION
       This command can be used to get or set client identifier of MQTT message.  This command is valid only for
       following MQTT message types:

	   CONNECT

       Syntax

       MQTT::client_id [  ]

       MQTT::client_id
	   * Get the client identifier of MQTT CONNECT message.

       MQTT::client_id 
	   * Set the client identifier of MQTT CONNECT message to specified string.

RETURN VALUE
       When called without an argument, this command returns the client identifier of MQTT message.

VALID DURING
       MQTT_CLIENT_INGRESS MQTT_SERVER_INGRESS MQTT_CLIENT_DATA MQTT_SERVER_DATA MQTT_CLIENT_EGRESS
       MQTT_SERVER_EGRESS

EXAMPLES
	# Block connections from clientid in the blacklist_clientid_datagroup
	when MQTT_CLIENT_INGRESS {
	   set type [MQTT::type]
	   switch $type {
	       "CONNECT" {
		   set cid [MQTT::client_id]
		   if { [class exists blacklist_clientid_datagroup] } {
		       if {[class match  $cid equals blacklist_clientid_datagroup] != ""} {
			   MQTT::drop
			   MQTT::respond type CONNACK return_code 2
			   MQTT::disconnect
		       }
		   }
	       }
	   }
	}

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-13.0.0 --First introduced the command.

BIG-IP						      2020-06-23					     iRule(1)