Class MqttConfiguration
- java.lang.Object
-
- de.iip_ecosphere.platform.transport.spring.BasicConfiguration
-
- de.iip_ecosphere.platform.transport.spring.binder.mqttv5.MqttConfiguration
-
@ConfigurationProperties(prefix="mqtt") public class MqttConfiguration extends de.iip_ecosphere.platform.transport.spring.BasicConfigurationRepresents the configuration options of a MQTT v5 client.- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private intactionTimeoutprivate booleanautoClientIdprivate java.lang.StringclientIdprivate java.util.List<java.lang.String>filteredTopicsprivate intkeepAliveprivate java.lang.Stringqosprivate java.lang.Stringschema
-
Constructor Summary
Constructors Constructor Description MqttConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetActionTimeout()Returns the action timeout to wait for the broker to complete an action.booleangetAutoClientId()Returns whether making the client ID unique is enabled.java.lang.StringgetBrokerString()Returns the broker connection string consisting ofgetSchema(),BasicConfiguration.getHost()andBasicConfiguration.getPort().java.lang.StringgetClientId()Returns the client identification.java.util.List<java.lang.String>getFilteredTopics()Returns all filtered topics.intgetKeepAlive()Returns the keep-alive time between heartbeats.de.iip_ecosphere.platform.transport.connectors.basics.MqttQoSgetQos()Returns the QoS level for sending.java.lang.StringgetSchema()Returns the connection schema.booleanisFilteredTopic(java.lang.String topic)Returns whethertopicis a filtered topic, i.e., we shall not subscribe to this topic.voidsetActionTimeout(int actionTimeout)Changes the action timeout to wait for the broker to complete an action.voidsetAutoClientId(boolean autoClientId)Changes whether the client identification is expected to be unique or shall be made unique upon first connect.voidsetClientId(java.lang.String clientId)Changes the client identification.voidsetFilteredTopics(java.util.List<java.lang.String> filteredTopics)Changes all filtered topics.voidsetKeepAlive(int keepAlive)Changes the keep-alive time between heartbeats.voidsetQos(java.lang.String qos)Defines the QoS level.voidsetSchema(java.lang.String schema)Changes the connection schema.de.iip_ecosphere.platform.transport.connectors.TransportParametertoTransportParameter()Turns the actual configuration into aTransportParameterinstance.-
Methods inherited from class de.iip_ecosphere.platform.transport.spring.BasicConfiguration
createTlsContext, createTransportParameterBuilder, createTrustManagerFactory, getAuthenticationKey, getHost, getHostnameVerification, getKeyAlias, getKeystoreKey, getPort, setAuthenticationKey, setHost, setHostnameVerification, setKeyAlias, setKeystoreKey, setPort, useTls
-
-
-
-
Field Detail
-
schema
private java.lang.String schema
-
clientId
private java.lang.String clientId
-
autoClientId
private boolean autoClientId
-
keepAlive
private int keepAlive
-
actionTimeout
private int actionTimeout
-
filteredTopics
private java.util.List<java.lang.String> filteredTopics
-
qos
private java.lang.String qos
-
-
Method Detail
-
isFilteredTopic
public boolean isFilteredTopic(java.lang.String topic)
Returns whethertopicis a filtered topic, i.e., we shall not subscribe to this topic.- Parameters:
topic- the topic name- Returns:
trueif the topic is filtered (no subscription),falseelse
-
getFilteredTopics
public java.util.List<java.lang.String> getFilteredTopics()
Returns all filtered topics.- Returns:
- the filtered topics
- See Also:
isFilteredTopic(String)
-
getBrokerString
public java.lang.String getBrokerString()
Returns the broker connection string consisting ofgetSchema(),BasicConfiguration.getHost()andBasicConfiguration.getPort().- Returns:
- the broker connection string
-
getSchema
public java.lang.String getSchema()
Returns the connection schema.- Returns:
- the connection schema ("tcp" by default)
-
getClientId
public java.lang.String getClientId()
Returns the client identification.- Returns:
- the client identification
-
getAutoClientId
public boolean getAutoClientId()
Returns whether making the client ID unique is enabled.- Returns:
truefor enabled (default),falseelse
-
getKeepAlive
public int getKeepAlive()
Returns the keep-alive time between heartbeats.- Returns:
- the keep-alive time in ms (60000 by default)
-
getActionTimeout
public int getActionTimeout()
Returns the action timeout to wait for the broker to complete an action.- Returns:
- the action timeout in ms (1000 by default)
-
getQos
public de.iip_ecosphere.platform.transport.connectors.basics.MqttQoS getQos()
Returns the QoS level for sending.- Returns:
- the QoS level
-
setSchema
public void setSchema(java.lang.String schema)
Changes the connection schema. [required by Spring]- Parameters:
schema- the connection schema
-
setClientId
public void setClientId(java.lang.String clientId)
Changes the client identification. [required by Spring]- Parameters:
clientId- the client identification
-
setAutoClientId
public void setAutoClientId(boolean autoClientId)
Changes whether the client identification is expected to be unique or shall be made unique upon first connect. [required by Spring]- Parameters:
autoClientId-true(default) for make unique,falseelse
-
setKeepAlive
public void setKeepAlive(int keepAlive)
Changes the keep-alive time between heartbeats. [required by Spring]- Parameters:
keepAlive- the keep-alive time in ms
-
setActionTimeout
public void setActionTimeout(int actionTimeout)
Changes the action timeout to wait for the broker to complete an action. [required by Spring]- Parameters:
actionTimeout- the action timeout in ms
-
setFilteredTopics
public void setFilteredTopics(java.util.List<java.lang.String> filteredTopics)
Changes all filtered topics. [required by Spring]- Parameters:
filteredTopics- the new filtered topics- See Also:
isFilteredTopic(String)
-
setQos
public void setQos(java.lang.String qos)
Defines the QoS level.- Parameters:
qos- the QoS level, ignored if invalid, seeMqttQoS
-
toTransportParameter
public de.iip_ecosphere.platform.transport.connectors.TransportParameter toTransportParameter()
Turns the actual configuration into aTransportParameterinstance.- Overrides:
toTransportParameterin classde.iip_ecosphere.platform.transport.spring.BasicConfiguration- Returns:
- the transport parameter instance
-
-