resolveAll method

Future<List<ConnectionParams>> resolveAll(
  1. String? correlationId
)

Resolves all component connection. If connections are configured to be retrieved from Discovery service it finds a IDiscovery and resolves the connection there.

  • correlationId (optional) transaction id to trace execution through call chain. Return Future that receives resolved connections Throws error.

See IDiscovery

Implementation

Future<List<ConnectionParams>> resolveAll(String? correlationId) async {
  var resolved = <ConnectionParams>[];
  var toResolve = <ConnectionParams>[];

  for (var index = 0; index < _connections.length; index++) {
    if (_connections[index].useDiscovery()) {
      toResolve.add(_connections[index]);
    } else {
      resolved.add(_connections[index]);
    }
  }

  if (toResolve.isEmpty) {
    return resolved;
  }

  for (var connection in toResolve) {
    var result = await _resolveAllInDiscovery(correlationId, connection);
    for (var index = 0; index < result.length; index++) {
      var localResolvedConnection = ConnectionParams(
          ConfigParams.mergeConfigs([connection, result[index]]));
      resolved.add(localResolvedConnection);
    }
  }

  return resolved;
}