Link Search Menu Expand Document

General Configuration

The general connection configuration declares the most common and often used properties to stablish an MQTT connection with a broker.

You can connect with a MQTT broker by only providing the host parameter; all other parameters will use default values as defined in the MQTT specification. If not defined there, reasonable default values will be used.

General Configuration Example

    • mqtt5-connection

    • <mqtt:config name="MQTT5">
        <mqtt:mqtt5-connection host="test.mosquitto.org" port="1883" clientId="TestIdentifier"
                               cleanStart="TRUE" sessionExpiryInterval="60"/>
      </mqtt:config>
      
    • mqtt3-connection

    • <mqtt:config name="MQTT3">
        <mqtt:mqtt3-connection host="test.mosquitto.org" port="1883" 
                               clientId="TestIdentifier" cleanSession="TRUE"/>
      </mqtt:config>
      

Host

The host name or IP address of the MQTT server.

PropertyDefault valueExpression
host-not supported

Port

The port of the MQTT server.

PropertyDefault valueExpression
port1883not supported

Identifier

The unique identifier of the MQTT client.

PropertyDefault valueExpression
identifierconnector generates an identifiernot supported
  • Clean Start

    If true and there is a session associated with the configured clientId, the server must resume communication with the client based on the state of the session. If there is no session associated with the clientId, the server must create a new session.

    If set to false a new session is always created.

    PropertyDefault valueExpression
    cleanStartTRUEnot supported

    It’s important to note that if the sessionExpiryInterval property is empty or 0, then sessions are n ot going to be stored for the client.

    Session Expiry Interval

    Defines the period of time that the broker stores the session information of that particular MQTT client. When the session expiry interval is set to 0 or empty, the session information is immediately removed from the broker as soon as the network connection of the client closes. The Session Expiry Interval Unit property qualifies the Connect Timeout attribute

    PropertyDefault valueExpression
    sessionExpiryInterval60not supported
    sessionExpiryIntervalUnitSECONDSnot supported
  • Clean Session

    Determines if the client wants to start a new “clean” session (true) or wants to resume a previous session if available (false).

    PropertyDefault valueExpression
    cleanSessionTRUEnot supported