RabbitMQConnectionResolver

Helper class for connections

Implements: IReferenceable, IConfigurable

Description

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

Configuration parameters

  • connection(s):
    • discovery_key: (optional) a 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) a key to retrieve the credentials from ICredentialStore
    • username: user name
    • password: user password

References

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

Constructors

Creates a new instance of the factory.

public constructor()

Fields

_connectionResolver

Connection resolver.

protected _connectionResolver: ConnectionResolver

_credentialResolver

Credential resolver.

protected _credentialResolver: CredentialResolver

Instance methods

compose

Composes RabbitMQ connection options from connection and credential parameters.

public compose(context: IContext, connection: ConnectionParams, credential: CredentialParams): Promise<any>

  • context: IContext - (optional) a context to trace execution through a call chain.
  • connection: ConnectionParams - connection parameters
  • credential: CredentialParams - credential parameters
  • returns: Promise<any> - resolved RabbitMQ connection options.

configure

Configures the component by passing its configuration parameters.

public configure(config: ConfigParams): void

  • config: ConfigParams - configuration parameters to be set.

resolve

Resolves RabbitMQ connection options from connection and credential parameters.

public resolve(context: IContext): Promise<any>

  • context: IContext - (optional) a context to trace execution through a call chain.
  • returns: Promise<any> - resolved RabbitMQ connection options.

setReferences

Sets references to dependent components.

public setReferences(references: IReferences): void

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