Skip to main content
Skip table of contents

MQTT Connector: Configuration

To provide the required information for the subscriber, a configuration file with the extension *.mqtt is required, which is loaded when the server is started.

The configuration file is located at the main level of the project and is loaded when the server is started.

The values for clientId, cleanSession and timeout can also be set via adapter parameters.

If not all parameters are set via the adapter parameters, the values from *.mqtt are used.

How to create the configuration file

  1. Right-click on the name of the project in the Projects view.
    A dialog window opens.

  2. Select New > .mqtt. The configuration file with the extension .mqtt has now been created at the main level of the project.

The file has the following structure:

CODE
<?xml version="1.0" encoding="UTF-8"?>
<MqttConfiguration>
	<threadPoolSize>10</threadPoolSize> 
	<broker server = "tcp://localhost:1883"> 
		<client id="1" active="true" cleanSession="false" timeout="30" automaticReconnect="true">
			<topic filter="topic1" qos="AT_LEAST_ONCE"></topic>
			<process url="Processes/data.wrf"></process>
		</client>
	</broker>
</MqttConfiguration>

The following attributes and elements are contained in the configuration file:

Element / Attribute

Description

MqttConfiguration

Root element of the configuration file

threadPoolSize

Number of usable threads

Possible values:

Integer

broker server

Host and port of the broker

Possible values:

Host and port of the broker, separated by a semicolon

client ID

Unique client ID with the following attributes:

  • active: The subscriber process is only started for an active client.
    Possible values:

    • true: The client is active.

    • false: The client is not active.

  • cleanSession: Determines whether or not data is deleted after a session.
    Possible values:

    • true: Data is deleted after a session.

    • false: Data is not deleted after a session.

  • timeout: Value in seconds, how long the client connection should be maintained or after which time the connection should be disconnected.
    Possible values:
    Integer

  • automaticReconnect: Specifies whether the client should be reconnected if the connection is lost.
    Possible values:

    • true: The client should be reconnected if the connection is lost.

    • false: The client should not be reconnected if the connection is lost.

topic

Topic that can be subscribed to in order to receive the published message. It has the following attributes:

  • filter: Name of the topic filter

  • qos: Quality of service

qos

A quality of service (QOS) can be set for topics. There are three possible QOS. This can be set in the configuration file as follows:

  • AT_LEAST_ONCE: The message is delivered at least once. This is the safest option.

  • AT_MOST_ONCE: There is no guarantee that the message will be delivered. The fastest option.

  • EXACTLY_ONCE: The message is delivered or not delivered exactly once. Guarantees that no duplicates are delivered.

process url

Specifies the process in which the received data is to be used. The received data is written to the process as XML.

Possible values:

Path to the process

Example:

"Processes/data.wrf"

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.