Class MqttConnectorCommonConfiguration
- java.lang.Object
-
- io.smallrye.reactive.messaging.mqtt.MqttConnectorCommonConfiguration
-
- Direct Known Subclasses:
MqttConnectorIncomingConfiguration,MqttConnectorOutgoingConfiguration
public class MqttConnectorCommonConfiguration extends Object
Extracts the common configuration for thesmallrye-mqttconnector.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.microprofile.config.Configconfig
-
Constructor Summary
Constructors Constructor Description MqttConnectorCommonConfiguration(org.eclipse.microprofile.config.Config config)Creates a new MqttConnectorCommonConfiguration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.microprofile.config.Configconfig()BooleangetAutoCleanSession()Gets the auto-clean-session value from the configuration.BooleangetAutoGeneratedClientId()Gets the auto-generated-client-id value from the configuration.BooleangetAutoKeepAlive()Gets the auto-keep-alive value from the configuration.StringgetChannel()Optional<String>getClientId()Gets the client-id value from the configuration.IntegergetConnectTimeoutSeconds()Gets the connect-timeout-seconds value from the configuration.protected <T> Optional<T>getFromAlias(String alias, Class<T> type)Retrieves the value stored for the given alias.protected <T> TgetFromAliasWithDefaultValue(String alias, Class<T> type, T defaultValue)Retrieves the value stored for the given alias.StringgetHost()Gets the host value from the configuration.IntegergetKeepAliveSeconds()Gets the keep-alive-seconds value from the configuration.IntegergetMaxInflightQueue()Gets the max-inflight-queue value from the configuration.IntegergetMaxMessageSize()Gets the max-message-size value from the configuration.Optional<String>getPassword()Gets the password value from the configuration.Optional<Integer>getPort()Gets the port value from the configuration.IntegergetQos()Gets the qos value from the configuration.IntegergetReconnectAttempts()Gets the reconnect-attempts value from the configuration.IntegergetReconnectIntervalSeconds()Gets the reconnect-interval-seconds value from the configuration.Optional<String>getServerName()Gets the server-name value from the configuration.BooleangetSsl()Gets the ssl value from the configuration.Optional<String>getTopic()Gets the topic value from the configuration.BooleangetTrustAll()Gets the trust-all value from the configuration.Optional<String>getUsername()Gets the username value from the configuration.BooleangetWillFlag()Gets the will-flag value from the configuration.IntegergetWillQos()Gets the will-qos value from the configuration.BooleangetWillRetain()Gets the will-retain value from the configuration.voidvalidate()
-
-
-
Method Detail
-
config
public org.eclipse.microprofile.config.Config config()
- Returns:
- the connector configuration
-
getFromAlias
protected <T> Optional<T> getFromAlias(String alias, Class<T> type)
Retrieves the value stored for the given alias.- Type Parameters:
T- the targeted type- Parameters:
alias- the attribute alias, must not benullor blanktype- the targeted type- Returns:
- the configuration value for the given alias, empty if not set
-
getFromAliasWithDefaultValue
protected <T> T getFromAliasWithDefaultValue(String alias, Class<T> type, T defaultValue)
Retrieves the value stored for the given alias. Returns the default value if not present.- Type Parameters:
T- the targeted type- Parameters:
alias- the attribute alias, must not benullor blanktype- the targeted typedefaultValue- the default value- Returns:
- the configuration value for the given alias, empty if not set
-
getChannel
public String getChannel()
- Returns:
- the channel name
-
getClientId
public Optional<String> getClientId()
Gets the client-id value from the configuration. Attribute Name: client-id Description: Set the client identifier- Returns:
- the client-id
-
getAutoGeneratedClientId
public Boolean getAutoGeneratedClientId()
Gets the auto-generated-client-id value from the configuration. Attribute Name: auto-generated-client-id Description: Set if the MQTT client must generate clientId automatically Default Value: true- Returns:
- the auto-generated-client-id
-
getAutoKeepAlive
public Boolean getAutoKeepAlive()
Gets the auto-keep-alive value from the configuration. Attribute Name: auto-keep-alive Description: Set if the MQTT client must handle `PINGREQ` automatically Default Value: true- Returns:
- the auto-keep-alive
-
getSsl
public Boolean getSsl()
Gets the ssl value from the configuration. Attribute Name: ssl Description: Set whether SSL/TLS is enabled Default Value: false- Returns:
- the ssl
-
getKeepAliveSeconds
public Integer getKeepAliveSeconds()
Gets the keep-alive-seconds value from the configuration. Attribute Name: keep-alive-seconds Description: Set the keep alive timeout in seconds Default Value: 30- Returns:
- the keep-alive-seconds
-
getMaxInflightQueue
public Integer getMaxInflightQueue()
Gets the max-inflight-queue value from the configuration. Attribute Name: max-inflight-queue Description: Set max count of unacknowledged messages Default Value: 10- Returns:
- the max-inflight-queue
-
getAutoCleanSession
public Boolean getAutoCleanSession()
Gets the auto-clean-session value from the configuration. Attribute Name: auto-clean-session Description: Set to start with a clean session (`true` by default) Default Value: true- Returns:
- the auto-clean-session
-
getWillFlag
public Boolean getWillFlag()
Gets the will-flag value from the configuration. Attribute Name: will-flag Description: Set if will information are provided on connection Default Value: false- Returns:
- the will-flag
-
getWillRetain
public Boolean getWillRetain()
Gets the will-retain value from the configuration. Attribute Name: will-retain Description: Set if the will message must be retained Default Value: false- Returns:
- the will-retain
-
getWillQos
public Integer getWillQos()
Gets the will-qos value from the configuration. Attribute Name: will-qos Description: Set the QoS level for the will message Default Value: 0- Returns:
- the will-qos
-
getMaxMessageSize
public Integer getMaxMessageSize()
Gets the max-message-size value from the configuration. Attribute Name: max-message-size Description: Set max MQTT message size in bytes Default Value: 8092- Returns:
- the max-message-size
-
getReconnectAttempts
public Integer getReconnectAttempts()
Gets the reconnect-attempts value from the configuration. Attribute Name: reconnect-attempts Description: Set the max reconnect attempts Default Value: 5- Returns:
- the reconnect-attempts
-
getReconnectIntervalSeconds
public Integer getReconnectIntervalSeconds()
Gets the reconnect-interval-seconds value from the configuration. Attribute Name: reconnect-interval-seconds Description: Set the reconnect interval in seconds Default Value: 1- Returns:
- the reconnect-interval-seconds
-
getUsername
public Optional<String> getUsername()
Gets the username value from the configuration. Attribute Name: username Description: Set the username to connect to the server- Returns:
- the username
-
getPassword
public Optional<String> getPassword()
Gets the password value from the configuration. Attribute Name: password Description: Set the password to connect to the server- Returns:
- the password
-
getConnectTimeoutSeconds
public Integer getConnectTimeoutSeconds()
Gets the connect-timeout-seconds value from the configuration. Attribute Name: connect-timeout-seconds Description: Set the connect timeout (in seconds) Default Value: 60- Returns:
- the connect-timeout-seconds
-
getTrustAll
public Boolean getTrustAll()
Gets the trust-all value from the configuration. Attribute Name: trust-all Description: Set whether all server certificates should be trusted Default Value: false- Returns:
- the trust-all
-
getHost
public String getHost()
Gets the host value from the configuration. Attribute Name: host Description: Set the MQTT server host name/IP Mandatory: yes- Returns:
- the host
-
getPort
public Optional<Integer> getPort()
Gets the port value from the configuration. Attribute Name: port Description: Set the MQTT server port. Default to 8883 if ssl is enabled, or 1883 without ssl- Returns:
- the port
-
getServerName
public Optional<String> getServerName()
Gets the server-name value from the configuration. Attribute Name: server-name Description: Set the SNI server name- Returns:
- the server-name
-
getTopic
public Optional<String> getTopic()
Gets the topic value from the configuration. Attribute Name: topic Description: Set the MQTT topic. If not set, the channel name is used- Returns:
- the topic
-
getQos
public Integer getQos()
Gets the qos value from the configuration. Attribute Name: qos Description: Set the QoS level when subscribing to the topic or when sending a message Default Value: 0- Returns:
- the qos
-
validate
public void validate()
-
-