MqttConnectionResolver

Helper class that resolves an MQTT connection and credential parameters, validates them and generates connection options.

Implements: IReferenceable, IConfigurable

Description

The MqttConnectionResolver class allows you to resolve MQTT connections and credential parameters, validate them, and generate connection options.

Configuration parameters

  • connection(s):
    • discovery_key: (optional) key to retrieve the connection from IDiscovery
    • host: host name or IP address
    • port: port number
    • uri: resource URI or connection string with all parameters in it
  • credential(s):
    • store_key: (optional) key to retrieve the credentials from ICredentialStore
    • username: username
    • password: user’s password

References

  • *:discovery:*:*:1.0 - (optional) IDiscovery services
  • *:credential-store:*:*:1.0 - (optional) credential stores to resolve credentials

Fields

connectionResolver

Connection resolver

connectionResolver: ConnectionResolver

credentialResolver

Credential resolver

credentialResolver: CredentialResolver

Instance methods

compose

Composes MQTT connection options from connection and credential parameters.

Future<ConfigParams> compose(String? correlationId, ConnectionParams connection, CredentialParams credential)

  • correlationId: String? - (optional) transaction id used to trace execution through the call chain.
  • connections: ConnectionParams - connection parameters
  • credential: CredentialParams - credential parameters
  • returns: Future<ConfigParams> - resolved MQTT connection options

configure

Configures the component by passing its configuration parameters.

@override

void configure(ConfigParams config)

  • config: ConfigParams - configuration parameters to be set.

resolve

Resolves MQTT connection options from connection and credential parameters.

Future<ConfigParams> resolve(String? correlationId)

  • correlationId: String? - (optional) transaction id used to trace execution through the call chain.
  • returns: Future<ConfigParams> - resolved MQTT connection options.

setReferences

Sets references to dependent components.

void setReferences(IReferences references)

  • references: IReferences - references to locate the component dependencies.