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-mqtt
connector.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.microprofile.config.Config
config
-
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.Config
config()
Boolean
getAutoCleanSession()
Gets the auto-clean-session value from the configuration.Boolean
getAutoGeneratedClientId()
Gets the auto-generated-client-id value from the configuration.Boolean
getAutoKeepAlive()
Gets the auto-keep-alive value from the configuration.String
getChannel()
Optional<String>
getClientId()
Gets the client-id value from the configuration.Integer
getConnectTimeoutSeconds()
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> T
getFromAliasWithDefaultValue(String alias, Class<T> type, T defaultValue)
Retrieves the value stored for the given alias.String
getHost()
Gets the host value from the configuration.Integer
getKeepAliveSeconds()
Gets the keep-alive-seconds value from the configuration.Integer
getMaxInflightQueue()
Gets the max-inflight-queue value from the configuration.Integer
getMaxMessageSize()
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.Integer
getQos()
Gets the qos value from the configuration.Integer
getReconnectAttempts()
Gets the reconnect-attempts value from the configuration.Integer
getReconnectIntervalSeconds()
Gets the reconnect-interval-seconds value from the configuration.Optional<String>
getServerName()
Gets the server-name value from the configuration.Boolean
getSsl()
Gets the ssl value from the configuration.Optional<String>
getTopic()
Gets the topic value from the configuration.Boolean
getTrustAll()
Gets the trust-all value from the configuration.Optional<String>
getUsername()
Gets the username value from the configuration.Boolean
getWillFlag()
Gets the will-flag value from the configuration.Integer
getWillQos()
Gets the will-qos value from the configuration.Boolean
getWillRetain()
Gets the will-retain value from the configuration.void
validate()
-
-
-
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 benull
or 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 benull
or 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. -1 means no limit Default Value: -1- 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()
-
-