Class MqttConnectorCommonConfiguration
java.lang.Object
io.smallrye.reactive.messaging.mqtt.MqttConnectorCommonConfiguration
- Direct Known Subclasses:
MqttConnectorIncomingConfiguration,MqttConnectorOutgoingConfiguration
Extracts the common configuration for the
smallrye-mqtt connector.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMqttConnectorCommonConfiguration(org.eclipse.microprofile.config.Config config) Creates a new MqttConnectorCommonConfiguration. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.microprofile.config.Configconfig()Gets the auto-clean-session value from the configuration.Gets the auto-generated-client-id value from the configuration.Gets the auto-keep-alive value from the configuration.Gets the client-id value from the configuration.Gets the client-options-name value from the configuration.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.Gets the health-enabled value from the configuration.getHost()Gets the host value from the configuration.Gets the keep-alive-seconds value from the configuration.Gets the max-inflight-queue value from the configuration.Gets the max-message-size value from the configuration.Gets the password value from the configuration.getPort()Gets the port value from the configuration.getQos()Gets the qos value from the configuration.Gets the reconnect-interval-seconds value from the configuration.Gets the server-name value from the configuration.getSsl()Gets the ssl value from the configuration.Gets the ssl.hostname-verification-algorithm value from the configuration.Gets the ssl.keystore.location value from the configuration.Gets the ssl.keystore.password value from the configuration.Gets the ssl.keystore.type value from the configuration.Gets the ssl.truststore.location value from the configuration.Gets the ssl.truststore.password value from the configuration.Gets the ssl.truststore.type value from the configuration.getTopic()Gets the topic value from the configuration.Gets the trust-all value from the configuration.Gets the unsubscribe-on-disconnection value from the configuration.Gets the username value from the configuration.Gets the will-flag value from the configuration.Gets the will-qos value from the configuration.Gets the will-retain value from the configuration.voidvalidate()
-
Field Details
-
config
protected final org.eclipse.microprofile.config.Config config
-
-
Constructor Details
-
MqttConnectorCommonConfiguration
public MqttConnectorCommonConfiguration(org.eclipse.microprofile.config.Config config) Creates a new MqttConnectorCommonConfiguration.
-
-
Method Details
-
config
public org.eclipse.microprofile.config.Config config()- Returns:
- the connector configuration
-
getFromAlias
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
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
- Returns:
- the channel name
-
getClientId
Gets the client-id value from the configuration. Attribute Name: client-id Description: Set the client identifier- Returns:
- the client-id
-
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
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
-
getHealthEnabled
Gets the health-enabled value from the configuration. Attribute Name: health-enabled Description: Whether health reporting is enabled (default) or disabled Default Value: true- Returns:
- the health-enabled
-
getSsl
Gets the ssl value from the configuration. Attribute Name: ssl Description: Set whether SSL/TLS is enabled Default Value: false- Returns:
- the ssl
-
getSslHostnameVerificationAlgorithm
Gets the ssl.hostname-verification-algorithm value from the configuration. Attribute Name: ssl.hostname-verification-algorithm Description: Set the hostname verifier algorithm for the TLS connection.Accepted values are `HTTPS`, `LDAPS`, and `NONE` (defaults). `NONE` disables the hostname verification. Default Value: NONE- Returns:
- the ssl.hostname-verification-algorithm
-
getSslKeystoreType
Gets the ssl.keystore.type value from the configuration. Attribute Name: ssl.keystore.type Description: Set the keystore type [`pkcs12`, `jks`, `pem`] Default Value: pkcs12- Returns:
- the ssl.keystore.type
-
getSslKeystoreLocation
Gets the ssl.keystore.location value from the configuration. Attribute Name: ssl.keystore.location Description: Set the keystore location. In case of `pem` type this is the server ca cert path- Returns:
- the ssl.keystore.location
-
getSslKeystorePassword
Gets the ssl.keystore.password value from the configuration. Attribute Name: ssl.keystore.password Description: Set the keystore password. In case of `pem` type this is the key path- Returns:
- the ssl.keystore.password
-
getSslTruststoreType
Gets the ssl.truststore.type value from the configuration. Attribute Name: ssl.truststore.type Description: Set the truststore type [`pkcs12`, `jks`, `pem`] Default Value: pkcs12- Returns:
- the ssl.truststore.type
-
getSslTruststoreLocation
Gets the ssl.truststore.location value from the configuration. Attribute Name: ssl.truststore.location Description: Set the truststore location. In case of `pem` type this is the client cert path- Returns:
- the ssl.truststore.location
-
getSslTruststorePassword
Gets the ssl.truststore.password value from the configuration. Attribute Name: ssl.truststore.password Description: Set the truststore password. In case of `pem` type this is not necessary- Returns:
- the ssl.truststore.password
-
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
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
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
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
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
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
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
-
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
Gets the username value from the configuration. Attribute Name: username Description: Set the username to connect to the server- Returns:
- the username
-
getPassword
Gets the password value from the configuration. Attribute Name: password Description: Set the password to connect to the server- Returns:
- the password
-
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
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
Gets the host value from the configuration. Attribute Name: host Description: Set the MQTT server host name/IP Mandatory: yes- Returns:
- the host
-
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
Gets the server-name value from the configuration. Attribute Name: server-name Description: Set the SNI server name- Returns:
- the server-name
-
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
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
-
getClientOptionsName
Gets the client-options-name value from the configuration. Attribute Name: client-options-name Description: The name of the MQTT Client Option bean (`io.smallrye.reactive.messaging.mqtt.session.MqttClientSessionOptions`) used to customize the MQTT client configuration MicroProfile Config Alias: mqtt-client-options-name- Returns:
- the client-options-name
-
getUnsubscribeOnDisconnection
Gets the unsubscribe-on-disconnection value from the configuration. Attribute Name: unsubscribe-on-disconnection Description: This flag restore the old behavior to unsubscribe from the broken on disconnection Default Value: false- Returns:
- the unsubscribe-on-disconnection
-
validate
public void validate()
-