ltm rule command MQTT dup
iRule(1) BIG-IP TMSH Manual iRule(1)
MQTT::dup
Get or set duplicate flag of MQTT PUBLISH message.
SYNOPSIS
MQTT::dup ('0' | '1')?
DESCRIPTION
This command can be used to get or set duplicate flag of MQTT message. This command is valid only for
following MQTT message types:
PUBLISH
Syntax
MQTT::dup [ 0 | 1 ]
MQTT::dup
* Get the duplicate flag of MQTT PUBLISH message.
MQTT::dup 0
* reset the duplicate flag of MQTT PUBLISH message. This will convert the
message to as if it was the first occasion that client or server has
attempted to send this MQTT PUBLISH message.
MQTT::dup 1
* Set the duplicate flag of MQTT PUBLISH message. This will convert the message
to as if the message was a redelivery of an earlier attempt to send the message.
RETURN VALUE
When called without an argument, this command returns the duplicate flag of MQTT message.
VALID DURING
MQTT_CLIENT_INGRESS MQTT_SERVER_INGRESS MQTT_CLIENT_DATA MQTT_SERVER_DATA MQTT_CLIENT_EGRESS
MQTT_SERVER_EGRESS
EXAMPLES
#Downgrading QoS to 0:
when MQTT_CLIENT_INGRESS {
set type [MQTT::type]
switch $type {
"PUBLISH" {
set in_qos [MQTT::qos]
if { $in_qos > 0 } {
set pktid [MQTT::packet_id]
}
MQTT::dup 0
MQTT::qos 0
if { $in_qos == 1 } {
MQTT::respond type PUBACK packet_id $pktid
} elseif { $in_qos == 2 } {
MQTT::respond type PUBREC packet_id $pktid
}
}
"PUBREL" {
set pktid [MQTT::packet_id]
MQTT::drop
MQTT::respond type PUBCOMP packet_id $pktid
}
}
}
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-13.0.0 --First introduced the command.
BIG-IP 2020-06-23 iRule(1)