NatsConnectionResolver

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

Description

The NatsConnectionResolver class is used to resolve NATS 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

Methods

Compose

Composes NATS connection options from connection and credential parameters.

(c *NatsConnectionResolver) Compose(context IContext, connections []*ConnectionParams, credential *CredentialParams) (*ConfigParams, error)

Configure

Configures the component by passing its configuration parameters.

(c *NatsConnectionResolver) Configure(ctx context.Context, config *ConfigParams)

  • ctx: context.Context - operation context.
  • config: *ConfigParams - configuration parameters to be set.

Resolve

Resolves NATS connection options from connection and credential parameters.

(c *NatsConnectionResolver) Resolve(context IContext) (*ConfigParams, error)

  • context: IContext - (optional) a context to trace execution through a call chain.
  • returns: (*ConfigParams, error) - resolved NATS connection options.

SetReferences

Sets references to dependent components.

(c *NatsConnectionResolver) SetReferences(ctx context.Context, references IReferences)

  • ctx: context.Context - operation context.
  • references: IReferences - references to locate the component’s dependencies.