The Connect MQTT Advanced action is used to connect to an MQTT broker. The established connection is contextual to the User Path and will be used to perform all the other actions (Publish, Subscribe, etc.) on the broker.
Parameters
BrokerAlias (optional): The alias identifying the MQTT broker to interact with. All subsequent calls (Publish, Subscribe, etc.) associated to the current User Path will refer to the broker using this alias. The same User Path can therefore connect to several brokers and, for example, publish on one and subscribe on others. If the User Path only refers to one broker, this parameter can be left out.
Protocol (optional): Protocol used to connect to and communicate with the MQTT broker: "tls" or "tcp". The default protocol is "tcp".
Host (optional): The host of the MQTT broker (IP address or domain name). Default value is "localhost".
Port (optional): The port number of the MQTT broker. Defaults to "1883".
Username (optional): The username used to authenticate and authorize the client on the MQTT broker.
Password (optional): The password used to authenticate and authorize the client on the MQTT broker.
ClientId (optional): The identifier of the client connecting to the MQTT broker. Default is a randomly generated client identifier guaranteed to be unique per User Path and per Load Generator. It is strongly advised to use this default value rather than providing another one.
CaCert (optional): The path to a certifying certificate. Used in case the user has auto-signed certificates. The protocol used is "tls".
TrustAllCert (optional): Accepts any SSL certificate. Does not check the certificate validity. The protocol used is "tls".
ClientCertFile (optional): The path to a private certificate when the server requires a client authentication. The protocol used is "tls".
ClientPrivateKey (optional): The path to the private key of the client certificate. The protocol used is "tls".
ClientPrivateKeyPassword (optional): The private key password if encrypted. The protocol used is "tls".
Example
An example of connecting to a local broker using default parameter settings and associating the connection to the ‘LocalDefaultBroker’ alias:
BrokerAlias:LocalDefaultBroker
Protocol:tcp
Host:localhost
Port:1883
Subscribe
The Subscribe MQTT Advanced action is used to subscribe to a topic on an MQTT broker.
Parameters
BrokerAlias (optional): The alias identifying the MQTT broker to interact with. Assumes and requires that, for the current User Path, a connection (using the Connect Advanced action) has been established and associated to the specified BrokerAlias. If the User Path only connects to one broker, this parameter can be left out.
Topic (required): The name of the topic to subscribe to.
Qos (optional): The Quality of Service Level (QoS) for the message. Default is "0". The value ("0","1" or "2") determines the level of guarantee of a message reaching the other end. Refer to your broker’s documentation to understand and consistently use the levels of guarantees.
Example
An example subscribing to the ‘/neotys.com/share/news/’ topic with a default QoS value of "0" and using the connection associated to the ‘LocalDefaultBroker’ alias:
BrokerAlias:LocalDefaultBroker
Topic:/neotys.com/share/news/
QoS:0
Publish
The Publish MQTT Advanced action is used to publish a message on a specified topic to an MQTT broker.
Parameters
BrokerAlias (optional): The alias identifying the MQTT broker to interact with. Assumes and requires that, for the current User Path, a connection (using the Connect Advanced action) has been established and associated to the specified BrokerAlias. If the User Path only connects to one broker, this parameter can be left out.
Topic (required): The name of the topic to publish the message to.
Message (required): The content of the message to publish.
Qos (optional): The Quality of Service Level (QoS) for the message. Default is "0". The value ("0","1" or "2") determines the level of guarantee of a message reaching the other end. Refer to your broker’s documentation to understand and consistently use the levels of guarantees.
Example
An example publishing on the ‘/neotys.com/share/news/’ topic using the connection associated to the ‘LocalDefaultBroker’ alias:
BrokerAlias:LocalDefaultBroker
Topic:/neotys.com/share/news/
Message: "Webinar tomorrow at 19:00 on continuous performance testing"
Receive
The Receive MQTT Advanced action is used to receive messages on a specified topic in a constrained amount of time.
Parameters
BrokerAlias (optional): The alias identifying the MQTT broker to interact with. Assumes and requires that, for the current User Path, a connection (using the Connect Advanced action) has been established and associated to the specified BrokerAlias. If the User Path only connects to one broker, this parameter can be left out.
Topic (required): The name of the topic to receive messages to. It is required that a subscription be performed on the topic prior to using the Receive Advanced action and the name of the topic must be strictly identical to the one used by the Subscribe Advanced action.
MessageCount (optional): The number of messages expected to be received during "timeout" duration. Defaults to "1".
Timeout (optional): The maximum duration in milliseconds to wait for the number of messages specified by "MessageCount".
FailOnTimeout (optional): If set to "true", this action will fail if at least 'MessageCount' messages have not been received during "Timeout". Defaults to "true".
Example
An example of receiving messages on the ‘/neotys.com/share/news/’ topic using the connection associated to the ‘LocalDefaultBroker’ alias and expecting to receive at least 10 messages in 30 seconds, if this contract is not met the action will fail:
BrokerAlias:LocalDefaultBroker
Topic:/neotys.com/share/news/
MessageCount:10
Timeout:30000
FailOnTimeout: true
Unsubscribe
The Unsubscribe MQTT Advanced action is used to unsubscribe from a topic.
Parameters
BrokerAlias (optional): The alias identifying the MQTT broker to interact with. Assumes and requires that, for the current User Path, a connection (using the Connect Advanced action) has been established and associated to the specified BrokerAlias. If the User Path only connects to one broker, this parameter can be left out.
Topic (required): The name of the topic to unsubscribe to. It is an error to attempt to unsubscribe from a topic to which there is no subscription.
Example
An example unsubscribing from the ‘/neotys.com/share/news/’ topic on the connection associated to the ‘LocalDefaultBroker’ alias.
BrokerAlias:LocalDefaultBroker
Topic:/neotys.com/share/news/
Disconnect
The Disconnect MQTT Advanced action is used to disconnect from an MQTT broker.
Parameters
BrokerAlias (optional): The alias identifying the MQTT broker to interact with. Assumes and requires that, for the current User Path, a connection (using the Connect Advanced action) has been established and associated to the specified BrokerAlias. If the User Path only connects to one broker, this parameter can be left out. It is an error to attempt to disconnect from a topic to which there is no connection.
Example
An example of disconnecting from the ‘LocalDefaultBroker’ alias: