resolve method

Future<ConfigParams> resolve(
  1. String? correlationId
)

Resolves RabbitMQ connection options from connection and credential parameters. Parameters:

  • correlationId (optional) transaction id to trace execution through call chain. Retruns Future that receives resolved options Throw error.

Implementation

Future<ConfigParams> resolve(String? correlationId) async {
  ConnectionParams? connection;
  CredentialParams? credential;
  var err;

  await Future.wait([
    () async {
      try {
        connection = await connectionResolver.resolve(correlationId);
        //Validate connections
        _validateConnection(correlationId, connection);
      } catch (ex) {
        err = ex;
      }
    }(),
    () async {
      try {
        credential = await credentialResolver.lookup(correlationId);
        // Credentials are not validated right now
      } catch (ex) {
        err = ex;
      }
    }()
  ]);

  if (err != null) {
    throw err;
  }
  return _composeOptions(connection, credential);
}