IBMStreams com.ibm.streamsx.messaging Toolkit > com.ibm.streamsx.messaging 5.4.3 > com.ibm.streamsx.messaging.mqtt > MQTTSource
DEPRECATED: The com.ibm.streamsx.messaging.mqtt.MQTTSource operator is deprecated and is replaced by the com.ibm.streamsx.mqtt.MQTTSource operator in the com.ibm.streamsx.mqtt toolkit. The deprecated operator might be removed in a future release.
The MQTTSource operator subscribes to MQTT topics and receives messages when they are published to subscribed topics. You specify the list of topics that you want to subscribe to and the quality of service (QoS) for the topics when you connect to the MQTT server. You can update the list of topics and the QoS levels at run time by using the optional control input port.
Behavior in a consistent region
MQTTSource operator cannot be part of a consistent region. Connect MQTTSource operator to an ReplayableStart operator from the Standard Toolkit to achieve tuple replay. Messages are stored in an internal buffer before they are submitted to the output port. To reduce the chance of tuple loss during application failure, you may use the 'messageQueueSize' parameter to control this internal buffer size.
Required: topics
Optional: appConfigName, clientID, commandTimeout, connection, connectionDocument, dataAttributeName, keepAliveInterval, keyStore, keyStorePassword, messageQueueSize, password, passwordPropName, period, qos, qosStr, reconnectionBound, serverURI, sslProtocol, topicOutAttrName, trustStore, trustStorePassword, userID, userPropName
This is the optional control port. You can use the control port to update information at run time, such as the connection information that the operator uses to connect to an MQTT server, the topics that the operator subscribes to, or the QoS levels of the subscribed topics.
This is the data port and is mandatory.
The optional output port is an error port where the operator submits a single tuple for each failed message. The tuple contains a single attribute of type rstring or ustring, which contains the details of the error message.
Required: topics
Optional: appConfigName, clientID, commandTimeout, connection, connectionDocument, dataAttributeName, keepAliveInterval, keyStore, keyStorePassword, messageQueueSize, password, passwordPropName, period, qos, qosStr, reconnectionBound, serverURI, sslProtocol, topicOutAttrName, trustStore, trustStorePassword, userID, userPropName
This parameter specifies the name of application configuration that stores client credential information, the credential specified via application configruation overrides the one specified with userID and password parameters.
All clients connected to the same server must have a unique ID. This optional parameter allows user to specify a client id to use when connecting to a MQTT provider. An ID will be generated by the operator if this parameter is not specified.
This optional parameter is used to specify maximum time in millisecond to wait for an MQTT action to complete. A MQTT action can include connecting to a server, or publshing to a message. A value of 0 will cause the operator to wait indefinitely for an action to complete. A negative number will cause a runtime error. If unspecified, the default value for this parameter is 0.
Name of the connection specification of the MQTT element in the connection document.
Path to connection document. If unspecified, default to applicationDir/etc/connections.xml. If a relative path is specified, the path is relative to the application directory.
This optional parameter specifies the name of the attribute that is used to hold actual content of message, if not specified, in the case where multiple attributes are defined for the streams schema, the operator will look for attribute named data and use it as data attribute. In the case where the schema contains only a signle attribute, the operator will assume that the attribute is the data attribute
This optional parameter, measured in seconds, sets the maximum time interval between messages sent or received. It enables the client to detect if the server is no longer available. By default, it is set to 60 seconds. A value of 0 will disable it. Negative number will cause a runtime error.
This optional parameter of type rstring specifies the file that contains the public and private key certificates of the MQTT client. If a relative path is specified, the path is relative to the application directory.
This optional parameter of type rstring specifies the password to decrypt the encrypted keyStore file.
Specify size of internal buffer for queueing incoming tuples. The default buffer size is 50 tuples.
This optional parameter sets the password to use for the connection. Must be specified when userID parameter is used, or compile time error will occur
This parameter specifies the property name of password in the application configuration. If the appConfigName parameter is specified and the passwordPropName parameter is not set, a compile time error occurs.
This parameter specifies the time period in milliseconds the operator waits before it tries to reconnect. It is an optional parameter of type int64. Default value is 60000 ms.
List of qos for topic subscriptions, this attribute is mutually exclusive with qosStr attribute.
List of qos in string format for topic subscriptions. Multiple comma separated qos value can be specified, for example "0, 1". This attribute is mutually exclusive with qos attribute.
This optional parameter of type int32 specifies the number of successive connections that are attempted for an operator. Specify 0 for no retry, n for n number of retries, -1 for inifinite retry.
This optional parameter of type rstring specifies the URI of the MQTT server to connect to. The serverURI has the following format: protocol://hostname or IP address:portnumber. The supported protocols are SSL and TCP. To use SSL authentication, set the protocol to ssl.
This optional parameter of type rstring specifies the ssl protocol to use for making SSL connections. If this parameter is not specified, the default protocol TLSv1.2 will be used.
Output attribute on output data stream to assign message topic to.
List of topics to subscribe to. Multiple comma separated topics can be specified, for example "topic1, topic2"
This optional parameter of type rstring specifies the name of the file that contains the public certificate of the trusted MQTT server. If a relative path is specified, the path is relative to the application directory.
This optional parameter of type rstring specifies the password to decrypt the encrypted trustStore file.
This optional parameter sets the user name to use for the connection. Must be specified when password parameter is used, or compile time error will occur
This parameter specifies the property name of user name in the application configuration. If the appConfigName parameter is specified and the userPropName parameter is not set, a compile time error occurs.