MQTT Task
The MQTT Component implements a lightweight, fully-featured MQTT client.
Remarks
The MQTT Task provides a lightweight, fully-featured MQTT client implementation with support for version 3.1.1 and 5.0. The Task supports plaintext and TLS-enabled connections over both standard TCP and WebSockets.
MQTT Send Task
At a minimum, you must supply an RemoteHost, RemotePort, and ClientId for the connection. In order to authenticate with the MQTT server you will need to specify a User and Password. Topic and QOS should be set to publish a message to the specified Topic at the set QOS level.
The MQTT Task has support for SSL transport layer security. This may be enabled by setting SSLStartMode, SSLCert and SSLAcceptServerCert to appropriate values.
Sender Property List
The following is the full list of the properties of the sender task with short descriptions. Click on the links for further details.
CleanSession | Determines whether a clean session is used once connected. |
ClientId | A string that uniquely identifies this instance of the component to the server. |
Firewall | A set of properties related to firewall access. |
LogFile | The file to write logging information to at runtime. |
LogMode | What information gets logged during component execution. |
MessageText | The messages payload. |
Other | Defines a set of configuration settings to be used by the component. |
Password | A password if authentication is to be used. |
PersistentConnection | Instructs the component whether to keep the connection to the server open. |
ProtocolVersion | The MQTT protocol version that the component will conform to. |
QOS | The messages QoS level. |
RemoteHost | The address of the remote host. Domain names are resolved to IP addresses. |
RemotePort | The port of the MQTT server (default is 1883). The default port for SSL is 8883. |
RuntimeLicense | Specifies the component runtime license key. |
SSLAcceptServerCert | Instructs the component to unconditionally accept the server certificate that matches the supplied certificate. |
SSLAcceptServerCertAcceptAny | Tells the component to accept any server certificate. |
SSLCert | The certificate to use for client authentication during the SSL handshake. |
SSLStartMode | Determines how the component starts the SSL negotiation. |
Timeout | A timeout for the component. |
Topic | The topic to subscribe or publish to. |
User | A username if authentication is to be used. |
WillMessage | The message that the server should publish in the event of an ungraceful disconnection. |
WillTopic | The topic that the server should publish the WillMessage to in the event of an ungraceful disconnection. |
Config Settings
The following is a list of config settings for the task with short descriptions. Click on the links for further details.
AutoReconnect | Whether to automatically attempt to reconnect in the event of a connection error. |
ClientTopicAliasMax | The maximum value the client will accept for a topic alias sent by the server. |
ConnectionTimeout | How long to wait for a connection attempt to succeed. |
ConnectProperties | JSON string specifying properties to be included in the CONNECT packet. |
DisconnectProperties | JSON string containing DISCONNECT packet properties. |
DisconnectReasonCode | Code describing the reason the client or server closed the connection. |
Duplicate | Whether to set the Duplicate flag when publishing a message. |
LogLevel | The level of detail that is logged. |
OutgoingMessageProperties | JSON string specifying properties to be included in the PUBLISH packet. |
RepublishInterval | How many seconds to wait before republishing unacknowledged messages. |
ResponseTopic | Topic name for a response message. |
Retain | Whether to set the Retain flag when publishing a message. |
SendCustomPacket | Sends a packet constructed using the supplied hex byte string. |
SessionExpInterval | The length of time in seconds the client and server should store session state data after the connection is closed. |
SessionStateFile | File to use for saving and restoring session data. |
SubscriptionIdentifier | A numeric subscription identifier included in SUBSCRIBE packet which will be returned with messages delivered for that subscription. |
TopicAlias | Value that is used to identify the Topic instead of using the Topic Name in order to reduce packet size. |
TopicDelimiter | The string to use as a delimiter in a topic filter list string. |
TopicNLArray | List of No Local option flags for subscription topic filters. |
TopicQOSArray | Comma-separated list of topic filter QoS values to use when subscribing. |
TopicRAPArray | List of Retain As Published option flags for subscription topic filters. |
TopicRHArray | List of Retain Handling option values for subscription topic filters. |
WillProperties | JSON string specifying will properties to be included in the CONNECT packet. |
WillQOS | The QoS value to use for the Will message. |
WillRetain | Whether the server should retain the Will message after publishing it. |
ReuseSSLSession | Determines if the SSL session is reused. |
SSLCipherStrength | The minimum cipher strength used for bulk encryption. |
SSLEnabledCipherSuites | The cipher suite to be used in an SSL negotiation. |
SSLEnabledProtocols | Used to enable/disable the supported security protocols. |
SSLIncludeCertChain | Whether the entire certificate chain is included in the SSLServerAuthentication event. |
SSLSecurityFlags | Flags that control certificate verification. |
TLS12SignatureAlgorithms | Defines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True. |
TLS12SupportedGroups | The supported groups for ECC. |
TLS13KeyShareGroups | The groups for which to pregenerate key shares. |
TLS13SignatureAlgorithms | The allowed certificate signature algorithms. |
TLS13SupportedGroups | The supported groups for (EC)DHE key exchange. |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
TcpNoDelay | Whether or not to delay when sending packets. |
UseInternalSecurityAPI | Whether or not to use the system security libraries or an internal implementation. |
CleanSession Property (MQTT Task)
Determines whether a clean session is used once connected.
Data Type
Boolean
Default Value
true
Remarks
This property determines whether or not the task should instruct the server to use a clean session when it connects.
By default, CleanSession is true, so the server will discard any state data previously associated with the current ClientId once the task has connected successfully. In addition, the server will not save any state data when the task disconnects.
Setting CleanSession to False before connecting will cause the server to re-associate any previously stored state data for the current ClientId. The server will also save any state data that exists when the task is disconnected.
The server-side session state consists of:
- whether a session is present,
- client subscriptions (including subscription identifiers in MQTT 5),
- QoS 1 and 2 messages sent to the client pending transmission or completed acknowledgment (and optionally pending QoS 0 messages),
- QoS 2 messages received from the client but not completely acknowledged, and
- the SessionExpInterval (in MQTT 5).
Note that retained messages are not deleted as a result of a session ending, but are not part of the session state.
Client-Side Session State
The client-side session state consists of:
- QoS 1 and QoS 2 messages which have been sent to the Server, but have not been completely acknowledged, and
- QoS 2 messages which have been received from the Server, but have not been completely acknowledged.
MQTT 5 Notes
In MQTT 5, the "Clean Session" flag from v3.1.1 is split into a "Clean Start" flag indicating that the server should discard previously saved session data from this connection, and a SessionExpInterval controlling the length of time the server should preserve the session data after disconnection.
In MQTT 5, this property acts only as the "Clean Start" flag. It determines whether or not the task should instruct the server to discard any previously stored session data associated with the current ClientId and start a new clean session.
For more information on session expiration in MQTT 5, see the SessionExpInterval config. Setting CleanSession to True in v3.1.1 is equivalent to setting CleanSession to True AND setting SessionExpInterval to 0 in MQTT 5.
As with MQTT 3.1.1, it is important for the client to save and restore its own session data on connection and disconnection depending on the value of CleanSession, and to manage its preservation depending on SessionExpInterval.
ClientId Property (MQTT Task)
A string that uniquely identifies this instance of the component to the server.
Data Type
String
Default Value
""
Remarks
The ClientId string is used by the server to uniquely identify each client that is connected to it. In MQTT 5, when the SessionExpInterval config is set to a positive value, the server will also associate it with any session state data that needs to be saved for the length of time specified when the task is disconnected.
If ClientId is empty and CleanSession is True, the task will automatically generate a unique value for ClientId before connecting. If CleanSession is False, the task throws an exception.
Duplicate Property (MQTT Task)
Whether the messages Duplicate flag is set.
Data Type
Boolean
Default Value
false
Remarks
If true, the message will have the duplicate flag set.
This property is not available in the Sender.
Firewall Property (MQTT Task)
A set of properties related to firewall access.
Data Type
Remarks
This is a Firewall type property which contains fields describing the firewall through which the task will attempt to connect.
LogFile Property (MQTT Task)
The file to write logging information to at runtime.
Data Type
String
Default Value
""
Remarks
To write logging information to a file instead of using the task's logging API, set this property to a valid file on disk.
When set, any logging information is appended to the specified file and not written to the task's logging API.
LogMode Property (MQTT Task)
What information gets logged during component execution.
Data Type
Enumeration
Possible Values
Verbose (0)
Info (1)
Warning (2)
Error (3)
Fatal (4)
Default Value
3
Remarks
This property controls what information the task logs. The possible values have the following affect on the task's behavior:
Verbose | The task will report all information regarding the transport. |
Info | The task will report all major operations, as well as all warnings and errors. |
Warning | The task will report any conditions that could result in unpredictable behavior as well as errors. |
Error | The task will report all errors that prevent normal operations from completing. |
Fatal | The task will report only serious errors that cause the task to completely stop functioning. |
MessageText Property (MQTT Task)
The messages payload.
Data Type
String
Default Value
""
Remarks
This contains the message payload.
This property is not available in the Receiver.
Other Property (MQTT Task)
Defines a set of configuration settings to be used by the component.
Data Type
String
Default Value
""
Remarks
The task accepts one or more configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the task, access to these internal properties is provided through the Other property.
The Other property may be set to one or more configuration settings (name/value pairs). Set one setting per line.
For example:
configname1=value1
configname2=value2
PacketId Property (MQTT Task)
The message's packet Id.
Data Type
Integer
Default Value
0
Remarks
The packet Id uniquely identifies a message for a client and broker.
This property is not available in the Sender.
Password Property (MQTT Task)
A password if authentication is to be used.
Data Type
Password
Default Value
""
Remarks
This property can be set to a password if authentication is to be used.
In MQTT 3.1.1, while a User may be specified without a Password, setting a Password without a User is not supported; attempting to do so will cause the server to reject the connection attempt.
In MQTT 5, a Password may be set without a User, allowing the field to be used for credentials other than a password.
PersistentConnection Property (MQTT Task)
Instructs the component whether to keep the connection to the server open.
Data Type
Boolean
Default Value
false
Remarks
If set to true, the task will first attempt to use an existing connection. If no such connection exists, it will create a new connection. When the task completes, it will persist the connection so that the task will reuse it during the next polling interval. Setting this property to true can improve performance if you are polling very frequently.
Set the Logoff configuration to tell the task to logoff from the persisted connection after completion.
ProtocolVersion Property (MQTT Task)
The MQTT protocol version that the component will conform to.
Data Type
Enumeration
Possible Values
V3 (0)
V5 (1)
Default Value
0
Remarks
This property specifies the version of the MQTT protocol to use. Possible values are:
0 (mvV3 - default) | MQTT 3.1.1 |
1 (mvV5) | MQTT 5 |
QOS Property (MQTT Task)
The messages QoS level.
Data Type
Integer
Default Value
0
Remarks
This property should be set to publish or receive messages at the specified QOS level.
QoS values set the service level for delivery of a message. Values range from 0 to 2 and have the following meanings:
Value | Description |
0 | At most once delivery - The published message is sent once, and if it does not arrive it is lost. |
1 | At least once delivery - Guarantees that the published message arrives, but there may be duplicates. |
2 | Exactly once delivery - Guarantees that the publish message arrives and that there are no duplicates. |
RemoteHost Property (MQTT Task)
The address of the remote host. Domain names are resolved to IP addresses.
Data Type
String
Default Value
""
Remarks
This property specifies the IP address (IP number in dotted internet format) or Domain Name of the remote host. It is set before a connection is attempted and cannot be changed once a connection is established.
If this property is set to a Domain Name, a DNS request is initiated, and upon successful termination of the request, this property is set to the corresponding address. If the search is not successful, an error is returned.
By default the task will connect in plaintext. To enable SSL set SSLStartMode
In addition, WebSocket connections are supported. To connect using WebSockets specify a hostname beginning with ws:// (plaintext) or wss:// (SSL). For instance, ws://test.mosquitto.org.
RemotePort Property (MQTT Task)
The port of the MQTT server (default is 1883). The default port for SSL is 8883.
Data Type
Integer
Default Value
1883
Remarks
This property specifies a service port on the remote host to connect to.
A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.
Retained Property (MQTT Task)
Whether or not this message's Retain flag is set.
Data Type
Boolean
Default Value
false
Remarks
If true, the message's Retain flag will be set.
Publishing a message with the Retain flag set will cause it to be retained by the server, which means the server will automatically deliver that message to any new subscribers to the topic.
This property is not available in the Sender.
RuntimeLicense Property (MQTT Task)
Specifies the component runtime license key.
Data Type
String
Default Value
""
Remarks
You can use the RuntimeLicense property to set the runtime key for the task license.
SSLAcceptServerCert Property (MQTT Task)
Instructs the component to unconditionally accept the server certificate that matches the supplied certificate.
Data Type
Remarks
If it finds any issues with the certificate presented by the server, the task will normally terminate the connection with an error. You may override this behavior by supplying a value for SSLAcceptServerCert. If the certificate supplied in SSLAcceptServerCert is the same as the certificate presented by the server, then the server certificate is accepted unconditionally, and the connection will continue normally.
This property is used to set a Public Key Certificate.
Ordinarily, the system will attempt to locate the public key in trusted certificate stores in the system registry. If a match is found, the certificate is trusted, and the process proceeds without error. If the certificate is not trusted, the task will report an error.
You may explicitly set a public key, either to accept a key that is not installed on the system, or to ensure that a specific key is presented. Public key certificates may be loaded from the machine registry or from file. If you click on the ellipses, a certificate selection dialog will open. To select a public key from the system registry, select the System Store tab or the User Store tab, and highlight the appropriate registry store. The list of available certificates will be shown below.
Alternatively, you may specify a public key on file. Select the PEM or Certificate File tabs to load a public key from file. You can use the browse button to examine the file system for the certificate that you wish to use. Public keys typically are stored in .CER, .DER, or .PEM files, but other formats may be used. You can click on the Open button to examine the contents of the certificate. Or, if you have a certificate stored in memory, you can write the contents of the certificate into the text box provided. Note that if you are loading a certificate from memory, the certificate must be Base-64 encoded, or the string representation of the certificate may become corrupted and uninterpretable.
Regardless of how you selected the certificate, once you hit the OK button, the task will attempt to verify that certificate selection. If successful, the subject of the certificate will be displayed in the property field. If the task was not able to verify the selection, a dialog box will appear instead detailing the verification error.
Note: You may also set SSLAcceptServerCertAcceptAny to True without opening the certificate selection dialog to force the task to unilaterally authenticate any server during the security handshake. It is strongly recommended that you use this only for testing purposes.
SSLAcceptServerCertAcceptAny Property (MQTT Task)
Tells the component to accept any server certificate.
Data Type
Boolean
Default Value
false
Remarks
When set to true, the task will unilaterally authenticate any server during the security handshake. It is strongly recommended that you use this only for testing purposes.
SSLCert Property (MQTT Task)
The certificate to use for client authentication during the SSL handshake.
Data Type
Remarks
This property is used to assign a specific certificate for SSL client authentication.
This field is used to set a Private Key Certificate.
Private key certificates may be loaded from the registry, from files in PKCS#12 format, or from a PEM file format. If you click on the ellipses, a certificate selection dialog will open. To select a private key from the system registry, select the System Store tab or the User Store tab, and highlight the appropriate registry store. The list of certificates which have private keys will be shown below.
To select a private key certificate from a file in PKCS#12 format, select the PFX Store tab. The browse button can be used to examine the file system for PKCS#12 (.pfx or .p12) certificates. If you wish to examine the certificate, provide the password in the field provided and click on the Open button to examine the file store for certificates present. To load a certificate from PEM files, select the PEM tab. Like the PFX file selection, you can specify the password and click the Open button to examine the certificates in the PEM store, or you may paste any PEM data stored in memory.
Regardless of how you selected the certificate, once you hit the OK button, the task will attempt to verify that certificate selection. If successful, the subject of the certificate will be displayed in the property field. If the task was not able to verify the selection, a dialog box will appear instead detailing the verification error.
SSLStartMode Property (MQTT Task)
Determines how the component starts the SSL negotiation.
Data Type
Enumeration
Possible Values
Automatic (0)
Implicit (1)
Explicit (2)
None (3)
Default Value
0
Remarks
The SSLStartMode property may have one of the following values:
Automatic | If the remote port is set to the standard plaintext port of the protocol (where applicable), the task will behave the same as if SSLStartMode is set to Explicit. In all other cases, SSL negotiation will be implicit (Implicit). |
Implicit | The SSL negotiation will start immediately after the connection is established. |
Explicit | The task will first connect in plaintext, and then explicitly start SSL negotiation through a protocol command such as STARTTLS. |
None | No SSL negotiation, no SSL security. All communication will be in plaintext mode. |
Timeout Property (MQTT Task)
A timeout for the component.
Data Type
Integer
Default Value
60
Remarks
If the Timeout property is set to 0, all operations will run uninterrupted until successful completion, or an error condition is encountered.
If Timeout is set to a positive value, the task will wait for the operation to complete before returning control.
If Timeout expires, and the operation is not yet complete, the task fails with an error.
Please note that by default, all timeouts are inactivity timeouts, i.e. the timeout period is extended by Timeout seconds when data is successfully sent or received.
Optionally, the behavior of the task may be changed to absolute timeouts, i.e. the task will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.
This behavior is controlled by the AbsoluteTimeout configuration setting.
The default value for the Timeout property is 60 (seconds).
Topic Property (MQTT Task)
The topic to subscribe or publish to.
Data Type
String
Default Value
""
Remarks
This property should be set to the topic name to subscribe or publish to.
Topic names are case-sensitive, must be 1-65535 characters long, and may include any characters except wildcard characters (# and +) and the null character. The / character separates levels within a topic name, which is important in the context of subscribing.
User Property (MQTT Task)
A username if authentication is to be used.
Data Type
String
Default Value
""
Remarks
This property can be set to a username if authentication is to be used.
In MQTT 3.1.1, while a User may be specified without a Password, setting a Password without a User is not supported; attempting to do so will cause the server to reject the connection attempt.
In MQTT 5, a Password may be set without a User, allowing the field to be used for credentials other than a password.
WillMessage Property (MQTT Task)
The message that the server should publish in the event of an ungraceful disconnection.
Data Type
String
Default Value
""
Remarks
This property may be set before calling Connect to specify to the server a message that should be published on WillTopic if the connection is closed ungracefully.
Note that the WillMessage will only be sent to the server if WillTopic is set.
Refer to WillTopic for more information about MQTT Will functionality.
WillTopic Property (MQTT Task)
The topic that the server should publish the WillMessage to in the event of an ungraceful disconnection.
Data Type
String
Default Value
""
Remarks
This property may be set to specify the topic name that the server should publish the WillMessage on if the connection is closed ungracefully.
MQTT Wills
The Will feature of MQTT allows a client to specify to the server a WillMessage to publish (as well as a WillTopic to publish it on) in the event of an ungraceful disconnection.
If there is not an ungraceful disconnection the server discards the Will message without publishing it. Note that in MQTT 5, the client can set a DisconnectReasonCode of 0x04 to instruct the server to publish the Will message anyway.
In addition to the WillTopic and WillMessage properties, the WillQOS setting may be used to specify the Will message's QoS level, and the WillRetain setting to set the Will message's Retain flag. Refer to those settings for more information.
If WillTopic is set to empty string (default), the task will not send a Will to the server.
In MQTT 5, the "WillDelayInterval" value in the WillProperties config can specify a delay between the ending of the connection and sending the will message, so that the WillMessage will not be sent if a connection is re-established within a certain period of time.
Certificate Type
The digital certificate being used.
Remarks
This type describes the current digital certificate. The certificate may be a public or private key. The fields are used to identify or select certificates.
Fields
The name of the certificate store for the client certificate.
The StoreType field specifies the type of the certificate store specified by Store. If the store is password protected, specify the password in StorePassword.
Store is used in conjunction with the Subject field in order to specify client certificates. If Store has a value, and Subject is set, a search for a certificate is initiated. Please refer to the Subject field for details.
Designations of certificate stores are platform-dependent.
The following are designations of the most common User and Machine certificate stores in Windows:
MY | A certificate store holding personal certificates with their associated private keys. |
CA | Certifying authority certificates. |
ROOT | Root certificates. |
SPC | Software publisher certificates. |
In Java, the certificate store normally is a file containing certificates and optional private keys.
When the certificate store type is PFXFile, this property must be set to the name of the file. When the type is PFXBlob, the property must be set to the binary contents of a PFX file (i.e. PKCS12 certificate store).
If the provider is OpenSSL, the certificate store is a file containing a certificate and a private key. This property must be set to the name of the file.
If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
The type of certificate store for this certificate.
The task supports both public and private keys in a variety of formats. When the cstAuto value is used, the task will automatically determine the type. This field can take one of the following values:
0 (cstUser - default) | For Windows, this specifies that the certificate store is a certificate store owned by the current user.
Note: This store type is not available in Java. |
1 (cstMachine) | For Windows, this specifies that the certificate store is a machine store.
Note: This store type is not available in Java. |
2 (cstPFXFile) | The certificate store is the name of a PFX (PKCS#12) file containing certificates. |
3 (cstPFXBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format. |
4 (cstJKSFile) | The certificate store is the name of a Java Key Store (JKS) file containing certificates.
Note: This store type is only available in Java. |
5 (cstJKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format.
Note: This store type is only available in Java. |
6 (cstPEMKeyFile) | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
7 (cstPEMKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate. |
8 (cstPublicKeyFile) | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
9 (cstPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate. |
10 (cstSSHPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key. |
11 (cstP7BFile) | The certificate store is the name of a PKCS#7 file containing certificates. |
12 (cstP7BBlob) | The certificate store is a string (binary) representing a certificate store in PKCS#7 format. |
13 (cstSSHPublicKeyFile) | The certificate store is the name of a file that contains an SSH-style public key. |
14 (cstPPKFile) | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
15 (cstPPKBlob) | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
16 (cstXMLFile) | The certificate store is the name of a file that contains a certificate in XML format. |
17 (cstXMLBlob) | The certificate store is a string that contains a certificate in XML format. |
18 (cstJWKFile) | The certificate store is the name of a file that contains a JWK (JSON Web Key). |
19 (cstJWKBlob) | The certificate store is a string that contains a JWK (JSON Web Key). |
21 (cstBCFKSFile) | The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store).
Note: This store type is only available in Java and .NET. |
22 (cstBCFKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format.
Note: This store type is only available in Java and .NET. |
23 (cstPKCS11) | The certificate is present on a physical security key accessible via a PKCS#11 interface.
To use a security key, the necessary data must first be collected using the CERTMGR task. The ListStoreCertificates method may be called after setting CertStoreType to cstPKCS11, CertStorePassword to the PIN, and CertStore to the full path of the PKCS#11 DLL. The certificate information returned in the CertList event's CertEncoded parameter may be saved for later use. When using a certificate, pass the previously saved security key information as the Store and set StorePassword to the PIN. Code Example. SSH Authentication with Security Key:
|
99 (cstAuto) | The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically. |
The subject of the certificate used for client authentication.
When this property is set, a search is performed in the current certificate store certificate with matching subject.
If an exact match is not found, the store is searched for subjects containing the value of the property.
When setting the property to a partial subject, CN= should be omitted. For example, the following code would find the certificate with subject CN=Test Certificate, OU=People, C=US
Example (Searching with partial subject)
Control.CertSubject = "Test"
If a match is not found, the property is set to an empty string, and no certificate is selected.
The special value "*" picks a random certificate in the certificate store.
If a matching certificate is found, Subject is set to the full subject of the matching certificate.
The thumbprint of the certificate.
This field is used to specify the thumbprint of the certificate. When there are multiple certificates in the store that have the same subject, the thumbprint will be used to distinguish between them.
Firewall Type
The firewall the component will connect through.
Remarks
When connecting through a firewall, this type is used to specify different properties of the firewall such as the firewall Host and the FirewallType.
Fields
Tells the task whether or not to automatically detect and use firewall system settings, if available.
Determines the type of firewall to connect through. The applicable values are the following:
Name or IP address of firewall (optional). If a Host is given, requested connections will be authenticated through the specified firewall when connecting.
If the Host field is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, the Host field is set to the corresponding address. If the search is not successful, an error is returned.
A password if authentication is to be used when connecting through the firewall. If Host is specified, the User and Password fields are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.
The TCP port for the firewall Host. See the description of the Host field for details.
Note that the Port is set automatically when FirewallType is set to a valid value. See the description of the FirewallType field for details.
A user name if authentication is to be used connecting through a firewall. If the Host is specified, the User and Password fields are used to connect and authenticate to the given Firewall. If the authentication fails, a trappable error is fired.
Config Settings (MQTT Task)
The task accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the task, access to these internal properties is provided through the Other property.MQTT Config Settings
This value is sent to the server in the CONNECT packet. It is also available in the ConnectProperties config. See the TopicAlias config for more details.
Valid only for MQTT 5.
To reset an individual value so that it is no longer included in the CONNECT packet (after it has previously been set), set it to "", or -1 for integers. To reset all ConnectProperties values, set the config JSON string to "".
Name | Type | Default | Description |
ClientTopicAliasMax | Integer | 0 | See ClientTopicAliasMax. |
MaximumPacketSize | Integer | Unlimited | Maximum Packet Size the Client is willing to accept (cannot be 0). |
ReceiveMaximum | Integer | 65,535 | The number of QoS 1 and QoS 2 publications the client is willing to process concurrently. |
RequestProblemInformation | Boolean | True | Indicates the server is allowed to return a Reason String and or User Properties on packets other than PUBLISH, CONNACK or DISCONNECT. |
RequestResponseInformation | Boolean | False | Indicates the client requests the server to return response information in the CONNACK packet. |
SessionExpInterval | Integer | 0 | See SessionExpInterval. |
To set these values, set the ConnectProperties config to a string JSON object containing one or more key/value pairs to set. For example, to set all values:
{
"ClientTopicAliasMax":"20",
"MaximumPacketSize":"128000",
"ReceiveMaximum":"12",
"RequestResponseInformation":"false",
"RequestProblemInformation":"true",
"SessionExpInterval":"1234"
}
Valid only for MQTT 5.
Supported properties are:
Name | Type | Default | Description |
SessionExpInterval | Integer | Value in CONNECT | Can only be sent by client. A new length of time for the client and server to store session state data. Cannot be non-zero if the client set it to zero in the CONNECT packet. If absent, the client and server should use the value specified in the CONNECT packet. |
ReasonString | String | N/A | A human readable string designed for diagnostics. |
To reset an individual value so that it is no longer included in the DISCONNECT packet (after it has previously been set), set it to "", or -1 for integers. To reset all DisconnectProperties values, set the config JSON string to "".
Valid only for MQTT 5.
This value will be populated when the task receives a DISCONNECT packet from the server.
For a full list of values applicable to be sent by the client, server or both, see the MQTT 5 specification. They include:
- 0x00: Normal disconnection - Close the connection normally. Do not send the Will Message.
- 0x04: Disconnect with Will Message (Client only) - The Client wishes to disconnect but requires that the Server also publishes its Will Message.
- 0x80: Unspecified error - The Connection is closed but the sender either does not wish to reveal the reason, or none of the other Reason Codes apply.
Valid only for MQTT 5.
This setting is ignored when messages are published with a QoS of 0.
Note: The Duplicate flag in an MQTT PUBLISH packet refers to the Id of the packet, not the message itself. According to the MQTT specification, it is possible (and perfectly legal) that a client could receive two QoS 1 PUBLISH packets with different Ids despite having the exact same message data.
0 (None) | No events are logged. |
1 (Info - default) | Informational events are logged. |
2 (Verbose) | Detailed data is logged. |
3 (Debug) | Debug data is logged. |
To reset an individual value so that it is no longer included in the PUBLISH packet (after it has previously been set), set it to "", or -1 for integers. To reset all OutgoingMessageProperties values, set the config JSON string to "".
Name | Type | Default | Description |
ContentType | String | N/A | String describing content of message to be sent to all subscribers receiving the message. |
CorrelationData | String | N/A | Hex-encoded binary string used by the sender of a request message to identify which request the response message is for when received (See ResponseTopic). |
MessageExpInterval | Integer | No exp. | Length of time after which the server must stop delivery to a subscriber if not yet processed. |
PayloadFormatIndicator | Integer | 0x00 | 0x00 = unspecified bytes. 0x01 = UTF-8 encoded character data. Sent to all subscribers receiving the message. |
ResponseTopic | String | N/A | See ResponseTopic. |
TopicAlias | Integer | N/A | See TopicAlias. |
UserProperty | String | "" | String key:value pair to be included in the header properties. The UserProperty can appear multiple times to represent multiple name, value pairs. |
To set these values, set the OutgoingMessageProperties config to a string JSON object containing one or more key/value pairs to set. For example:
{
"ContentType":"plain/text",
"CorrelationData":"00000000",
"MessageExpInterval":"1000",
"PayloadFormatIndicator":"1",
"ResponseTopic": "ResponseTopic",
"TopicAlias":"1",
"UserProperty":"prp1:val1",
"UserProperty":"prp2:val2"
}
Valid only for MQTT 5.
The default RepublishInterval is 60 seconds. Specify a RepublishInterval of 0 to prevent the task from automatically republishing messages.
In MQTT 5, messages are only republished if the client is disconnected before receiving a PUBACK or PUBREC. This property is only valid for MQTT 3.1.1.
To send a Request Message, set this value before calling PublishMessage.
To reset the value once it has been previously set, so that it is no longer included in future packets, set it to "".
ResponseTopic and Correlation Data are also accessible in the OutgoingMessageProperties config.
Valid only for MQTT 5.
Publishing a non-empty message with the Retain flag set and a non-zero QoS will cause the server to store it (replacing any previously retained message in the process) so that it can be delivered to any clients which subscribe to the topic in the future. (If the QoS is 0, the server can store the message, but it is not required to do so indefinitely, if at all.)
If the task publishes an empty message with the Retain flag set, then (regardless of its QoS) the server will remove any previously retained message for the topic.
Note that messages with the Retain flag set are still processed by the server and delivered as usual to clients currently subscribed to the topic, regardless of whether they are empty or not. Also note that retained messages are not part of a session's state, they are retained until they are either removed or replaced by another retained message, regardless of whether or not the client connected with CleanSession set to True.
The server may override this value. Additionally, the client may send a new value in the DisconnectProperties (as long as it was not 0 originally).
See CleanSession for more details on stored sessions in MQTT 5. This property also available in ConnectProperties.
Valid only for MQTT 5.
Note that this value applies only to SUBSCRIBE packets and not to outgoing or incoming messages. The client is not permitted to send a PUBLISH packet with a subscription id - the server will include it when it sends PUBLISH packets to subscribing clients if those clients have established ids. To access subscription ids of incoming messages, see the "SubscriptionIdentifiers" field in the MQTTMessage type.
To reset the value once it has been previously set, so that it is no longer included in future packets, set it to -1.
Valid only for MQTT 5.
A sender can modify the Topic Alias mapping by sending another PUBLISH in the same Network Connection with the same Topic Alias value and a different non-zero length Topic Name.
Note that a topic alias must have a value greater than zero and less than or equal to the maximum supported by the server. Topic alias mappings exist only within a connection and are not a part of stored session state data. The Topic Alias mappings used by the Client and Server are independent from each other.
To reset the value once it has been previously set, so that it is no longer included in future packets, set it to -1.
Also accessible in the OutgoingMessageProperties config.
Valid only for MQTT 5.
For topic filters subscribed to with a True flag, messages will not be forwarded to the same ClientId they were published from.
By default, this value is empty and all flags are False.
Valid only for MQTT 5.
If this setting is set to the empty string (default) when Subscribe is called with multiple topic filters, the task will use the QoS value passed to Subscribe for all of them.
For topic filters subscribed to with a True flag, messages forwarded for this subscription will keep the retain flag they were published with (as opposed to always being set to False).
By default, this value is empty and all flags are False.
Valid only for MQTT 5.
- 0 = send retained messages at the time of the subscribe
- 1 = send retained messages at subscribe only if the subscription does not currently exist
- 2 = do not send retained messages at the time of the subscribe
By default, this value is empty and all values are 0.
Valid only for MQTT 5.
To reset an individual value so that it is no longer included in the CONNECT packet (after it has previously been set), set it to "", or -1 for integers. To reset all WillProperties values, set the config JSON string to "".
Name | Type | Default | Description |
ContentType | String | N/A | String describing content of will message. |
CorrelationData | String | N/A | Hex-encoded binary string used by the sender of a request message to identify which request the response message is for when received. |
MessageExpInterval | Integer | No exp. | Length of time after which the server must stop delivery of the will message to a subscriber if not yet processed. |
PayloadFormatIndicator | Integer | 0x00 | 0x00 = unspecified bytes. |
ReponseTopic | String | N/A | Used as a topic name for a response message. |
WillDelayInterval | Integer | 0 | Delay in seconds after disconnection until the server should publish the client WillMessage. |
Note that these values will be ignored if WillTopic is empty.
To set these values, set the ConnectProperties config to a string JSON object containing one or more key/value pairs to set. For example, to set all values:
{
"ContentType":"text/plain",
"CorrelationData":"00000000",
"MessageExpInterval":"3600",
"PayloadFormatIndicator":"1",
"ResponseTopic": "ResponseTopic",
"WillDelayInterval":"10"
}
Valid only for MQTT 5.
Refer to WillTopic for more information.
See Retain for general information about how retained messages are handled by the server.
Refer to WillTopic for more information.
SSL Config Settings
If set to true, the task will reuse the context if and only if the following criteria are met:
- The target host name is the same.
- The system cache entry has not expired (default timeout is 10 hours).
- The application process that calls the function is the same.
- The logon session is the same.
- The instance of the task is the same.
Please note that this setting contains the minimum cipher strength requested from the security library.
Use this setting with caution. Requesting a lower cipher strength than necessary could potentially cause serious security vulnerabilities in your application.
By default, the enabled cipher suites will include all available ciphers ("*").
The special value "*" means that the task will pick all of the supported cipher suites. If SSLEnabledCipherSuites is set to any other value, only the specified cipher suites will be considered.
Multiple cipher suites are separated by semicolons.
Example values when UseInternalSecurityAPI is False (default):
// The "Other" property could contain ONE of the following lines:
SSLEnabledCipherSuites=*
SSLEnabledCipherSuites=CALG_AES_256
SSLEnabledCipherSuites=CALG_AES_256;CALG_3DES
Possible values when UseInternalSecurityAPI is False (default) include:
- CALG_3DES
- CALG_3DES_112
- CALG_AES
- CALG_AES_128
- CALG_AES_192
- CALG_AES_256
- CALG_AGREEDKEY_ANY
- CALG_CYLINK_MEK
- CALG_DES
- CALG_DESX
- CALG_DH_EPHEM
- CALG_DH_SF
- CALG_DSS_SIGN
- CALG_ECDH
- CALG_ECDH_EPHEM
- CALG_ECDSA
- CALG_ECMQV
- CALG_HASH_REPLACE_OWF
- CALG_HUGHES_MD5
- CALG_HMAC
- CALG_KEA_KEYX
- CALG_MAC
- CALG_MD2
- CALG_MD4
- CALG_MD5
- CALG_NO_SIGN
- CALG_OID_INFO_CNG_ONLY
- CALG_OID_INFO_PARAMETERS
- CALG_PCT1_MASTER
- CALG_RC2
- CALG_RC4
- CALG_RC5
- CALG_RSA_KEYX
- CALG_RSA_SIGN
- CALG_SCHANNEL_ENC_KEY
- CALG_SCHANNEL_MAC_KEY
- CALG_SCHANNEL_MASTER_HASH
- CALG_SEAL
- CALG_SHA
- CALG_SHA1
- CALG_SHA_256
- CALG_SHA_384
- CALG_SHA_512
- CALG_SKIPJACK
- CALG_SSL2_MASTER
- CALG_SSL3_MASTER
- CALG_SSL3_SHAMD5
- CALG_TEK
- CALG_TLS1_MASTER
- CALG_TLS1PRF
// The "Other" property could contain ONE of the following lines:
SSLEnabledCipherSuites=*
SSLEnabledCipherSuites=TLS_DHE_DSS_WITH_AES_128_CBC_SHA
SSLEnabledCipherSuites=TLS_DHE_DSS_WITH_AES_128_CBC_SHA;TLS_DH_ANON_WITH_AES_128_CBC_SHA
Possible values when UseInternalSecurityAPI is True include:
- TLS_DHE_DSS_WITH_AES_128_GCM_SHA256
- TLS_DHE_DSS_WITH_AES_256_GCM_SHA384
- TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
- TLS_DHE_DSS_WITH_AES_128_CBC_SHA
- TLS_DHE_DSS_WITH_AES_128_CBC_SHA256
- TLS_DHE_DSS_WITH_AES_256_CBC_SHA
- TLS_DHE_DSS_WITH_AES_256_CBC_SHA256
- TLS_DHE_DSS_WITH_DES_CBC_SHA
- TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
- TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
- TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
- TLS_DHE_RSA_WITH_AES_128_CBC_SHA
- TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
- TLS_DHE_RSA_WITH_AES_256_CBC_SHA
- TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
- TLS_DHE_RSA_WITH_DES_CBC_SHA
- TLS_RSA_WITH_AES_256_GCM_SHA384
- TLS_RSA_WITH_AES_128_GCM_SHA256
- TLS_RSA_WITH_3DES_EDE_CBC_SHA
- TLS_RSA_WITH_AES_128_CBC_SHA
- TLS_RSA_WITH_AES_128_CBC_SHA256
- TLS_RSA_WITH_AES_256_CBC_SHA
- TLS_RSA_WITH_AES_256_CBC_SHA256
- TLS_RSA_WITH_DES_CBC_SHA
- TLS_RSA_WITH_RC4_128_MD5
- TLS_RSA_WITH_RC4_128_SHA
If SSLEnabledProtocols is configured to use TLS 1.3 the following values are supported:
- TLS_AES_128_GCM_SHA256
- TLS_AES_256_GCM_SHA384
SSLEnabledCipherSuites is used together with SSLCipherStrength.
Not all supported protocols are enabled by default (the value of this setting is 4032). If you want more granular control over the enabled protocols, you can set this property to the binary 'OR' of one or more of the following values:
TLS1.3 | 12288 (Hex 3000) (Experimental) |
TLS1.2 | 3072 (Hex C00) (Default) |
TLS1.1 | 768 (Hex 300) (Default) |
TLS1 | 192 (Hex C0) (Default) |
SSL3 | 48 (Hex 30) |
SSL2 | 12 (Hex 0C) |
Note: TLS 1.1 and TLS1.2 support are only available starting with Windows 7.
Note: Enabling TLS 1.3 will automatically set UseInternalSecurityAPI to True.
If set to True all certificates returned by the server will be present in the transport log. This includes the leaf certificate, any intermediate certificate, and the root certificate.
Note: When UseInternalSecurityAPI is set to True this value is automatically set to True. This is needed for proper validation when using the internal provider.
0x00000001 | Ignore time validity status of certificate. |
0x00000002 | Ignore time validity status of CTL. |
0x00000004 | Ignore non-nested certificate times. |
0x00000010 | Allow unknown Certificate Authority. |
0x00000020 | Ignore wrong certificate usage. |
0x00000100 | Ignore unknown certificate revocation status. |
0x00000200 | Ignore unknown CTL signer revocation status. |
0x00000400 | Ignore unknown Certificate Authority revocation status. |
0x00000800 | Ignore unknown Root revocation status. |
0x00008000 | Allow test Root certificate. |
0x00004000 | Trust test Root certificate. |
0x80000000 | Ignore non-matching CN (certificate CN not-matching server name). |
When specified the task will verify that the server certificate signature algorithm is among the values specified in this setting. If the server certificate signature algorithm is unsupported the task will fail with an error.
The format of this value is a comma separated list of hash-signature combinations. For instance:
// The "Other" could contain ALL of these lines:
UseInternalSecurityAPI=true
SSLEnabledProtocols=3072
TLS12SignatureAlgorithms=sha1-rsa,sha1-dsa,sha256-rsa,sha256-dsa
The default value for this setting is "sha1-rsa,sha1-dsa,sha224-rsa,sha224-dsa,sha256-rsa,sha256-dsa,sha384-rsa,sha384-dsa,sha512-rsa,sha512-dsa".
In order to not restrict the server's certificate signature algorithm, specify an empty string as the value for this setting, which will cause the signature_algorithms TLS 1.2 extension to not be sent.
The default value is ecdhe_secp256r1,ecdhe_secp384r1,ecdhe_secp521r1.
When using TLS 1.2 and UseInternalSecurityAPI is set to True, the values refer to the supported groups for ECC. The following values are supported:
- "ecdhe_secp256r1" (default)
- "ecdhe_secp384r1" (default)
- "ecdhe_secp521r1" (default)
The default value is set to balance common supported groups and the computational resources required to generate key shares. As a result only some groups are included by default in this setting.
Note: All supported groups can always be used during the handshake even if not listed here, but if a group is used which is not present in this list it will incur an additional round trip and time to generate the key share for that group.
In most cases this setting does not need to be modified. This should only be modified if there is a specific reason to do so.
The default value is ecdhe_x25519,ecdhe_secp256r1,ecdhe_secp384r1,ffdhe_2048,ffdhe_3072
The values are ordered from most preferred to least preferred. The following values are supported:
- "ecdhe_x25519" (default)
- "ecdhe_x448"
- "ecdhe_secp256r1" (default)
- "ecdhe_secp384r1" (default)
- "ecdhe_secp521r1"
- "ffdhe_2048" (default)
- "ffdhe_3072" (default)
- "ffdhe_4096"
- "ffdhe_6144"
- "ffdhe_8192"
- "rsa_pkcs1_sha256" (default)
- "rsa_pkcs1_sha384" (default)
- "rsa_pkcs1_sha512" (default)
The default value is ecdhe_x25519,ecdhe_x448,ecdhe_secp256r1,ecdhe_secp384r1,ecdhe_secp521r1,ffdhe_2048,ffdhe_3072,ffdhe_4096,ffdhe_6144,ffdhe_8192
The values are ordered from most preferred to least preferred. The following values are supported:
- "ecdhe_x25519" (default)
- "ecdhe_x448" (default)
- "ecdhe_secp256r1" (default)
- "ecdhe_secp384r1" (default)
- "ecdhe_secp521r1" (default)
- "ffdhe_2048" (default)
- "ffdhe_3072" (default)
- "ffdhe_4096" (default)
- "ffdhe_6144" (default)
- "ffdhe_8192" (default)
General Config Settings
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the task initiate connections (or accept in the case of server tasks) only through that interface.
If the task is connected, the LocalHost configuration shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).
By default, this configuration setting is set to False.
Setting this configuration setting to True tells the task to use the internal implementation instead of using the system security libraries.
On Windows, this setting is set to False by default. On Linux/macOS, this setting is set to True by default.
If using the .NET Standard Library, this setting will be True on all platforms. The .NET Standard library does not support using the system security libraries.
Note: This setting is static. The value set is applicable to all tasks used in the application.
When this value is set, the product's system dynamic link library (DLL) is no longer required as a reference, as all unmanaged code is stored in that file.