Class HiveMQMqttConnectorCommonConfiguration

java.lang.Object
io.quarkiverse.hivemqclient.smallrye.reactive.HiveMQMqttConnectorCommonConfiguration
Direct Known Subclasses:
HiveMQMqttConnectorIncomingConfiguration, HiveMQMqttConnectorOutgoingConfiguration

public class HiveMQMqttConnectorCommonConfiguration extends Object
Extracts the common configuration for the smallrye-mqtt-hivemq connector.
  • Field Details

    • config

      protected final org.eclipse.microprofile.config.Config config
  • Constructor Details

    • HiveMQMqttConnectorCommonConfiguration

      public HiveMQMqttConnectorCommonConfiguration(org.eclipse.microprofile.config.Config config)
      Creates a new HiveMQMqttConnectorCommonConfiguration.
  • Method Details

    • 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 be null or blank
      type - 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 be null or blank
      type - the targeted type
      defaultValue - 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
    • getSslTruststoreType

      public String 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: jks
      Returns:
      the ssl.truststore.type
    • getSslTruststoreLocation

      public Optional<String> 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 cert path
      Returns:
      the ssl.truststore.location
    • getSslTruststorePassword

      public Optional<String> 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
    • getSslKeystoreType

      public String 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: jks
      Returns:
      the ssl.keystore.type
    • getSslKeystoreLocation

      public Optional<String> 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 cert path
      Returns:
      the ssl.keystore.location
    • getSslKeystorePassword

      public Optional<String> 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
    • getSslHostVerifier

      public Boolean getSslHostVerifier()
      Gets the ssl.hostVerifier value from the configuration. Attribute Name: ssl.hostVerifier Description: Enable or disable SSL host verification Default Value: true
      Returns:
      the ssl.hostVerifier
    • getCheckTopicEnabled

      public Boolean getCheckTopicEnabled()
      Gets the check-topic-enabled value from the configuration. Attribute Name: check-topic-enabled Description: Enable check for liveness/readiness Default Value: false
      Returns:
      the check-topic-enabled
    • getCheckTopicName

      public String getCheckTopicName()
      Gets the check-topic-name value from the configuration. Attribute Name: check-topic-name Description: Topic Used to check liveness/readiness Default Value: $SYS/broker/uptime
      Returns:
      the check-topic-name
    • getReadinessTimeout

      public Integer getReadinessTimeout()
      Gets the readiness-timeout value from the configuration. Attribute Name: readiness-timeout Description: Timeout to declare the MQTT Client not ready Default Value: 20000
      Returns:
      the readiness-timeout
    • getLivenessTimeout

      public Integer getLivenessTimeout()
      Gets the liveness-timeout value from the configuration. Attribute Name: liveness-timeout Description: Timeout to declare the MQTT Client not alive Default Value: 120000
      Returns:
      the liveness-timeout
    • validate

      public void validate()