ltm rule command MQTT willΒΆ

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

MQTT::will
       Get or set will-topic, will-message, will-qos, and will-retain fields of MQTT CONNECT message.

SYNOPSIS
       MQTT::will (('topic' (TOPIC)?) |
			   ('message' (CONTENT)?) |
			   ('qos' ('0' | '1' | '2')?) |
			   ('retain' ('0' | '1')?))

DESCRIPTION
       This command can be used to get or set will-topic, will-message, will-qos, and will-retain fields of MQTT
       message.  This command is valid only for following MQTT message types:

	   CONNECT

       Syntax

       MQTT::will (topic []) | (message []) | (qos []) | (retain [])

       MQTT::will topic
	   * Get the will-topic field of MQTT CONNECT message.

       MQTT::will topic 
	   * Set the will-topic field of MQTT CONNECT message to specified string.

       MQTT::will message
	   * Get the will-message field of MQTT CONNECT message.

       MQTT::will message 
	   * Set the will-message field of MQTT CONNECT message to specified string.

       MQTT::will qos
	   * Get the will-qos field of MQTT CONNECT message.

       MQTT::will qos 
	   * Set the will-qos field of MQTT CONNECT message to specified number.
	      can only be 0, 1, or 2.

       MQTT::will retain
	   * Get the will-retain field of MQTT CONNECT message.

       MQTT::will retain 
	   * Set the will-retain field of MQTT CONNECT message to specified number.
	      can only be 0 or 1.

RETURN VALUE
       When called without an argument, each of the sub-commands return the will-topic, will-message, will-qos, or
       will-retain field of MQTT CONNECT message.

VALID DURING
       MQTT_CLIENT_INGRESS MQTT_SERVER_INGRESS MQTT_CLIENT_DATA MQTT_SERVER_DATA MQTT_CLIENT_EGRESS
       MQTT_SERVER_EGRESS

EXAMPLES
	# Enforce a mandatary default will message, if will is not present in connect
	when MQTT_CLIENT_INGRESS {
	    set type [MQTT::type]
	    switch $type {
		"CONNECT" {
		    if { [MQTT::will topic] == "" } {
			MQTT::will topic "/bigip/default/will/[MQTT::username]/[MQTT::client_id]/[client_addr]"
			MQTT::will message "client disconnected without sending DISCONNECT message"
			MQTT::will qos 0
			MQTT::will retain 0
		    }
		}
	    }
	}

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

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