close method

  1. @override
Future close(
  1. String? correlationId
)

Closes this endpoint and the GRPC server (service) that was opened earlier.

  • correlationId (optional) transaction id to trace execution through call chain. Return Future the closing process is complete. Throws error if one is raised.

Implementation

@override
Future close(String? correlationId) async {
  if (_server != null) {
    _uri = null;
    _commandableMethods = null;
    _commandableSchemas = null;
    _services.clear();

    // Eat exceptions
    try {
      await _server!.shutdown();
      _logger.debug(correlationId, 'Closed GRPC service at %s', [_uri]);
      _commandableService = null;
      _server = null;
    } catch (ex) {
      _logger
          .warn(correlationId, 'Failed while closing GRPC service: %s', [ex]);
    }
  }
}