open method
Opens the component.
correlationId
(optional) transaction id to trace execution through call chain. Return Future that receives null no errors occured. Throws error
Implementation
@override
Future open(String? correlationId) async {
if (isOpen()) {
return;
}
var connection = await connectionResolver.resolve(correlationId);
try {
uri = connection?.getAsString('uri');
client = http.Client();
// this.client = restify.createJsonClient({
// url: this.uri,
// connectTimeout: this.connectTimeout,
// requestTimeout: this.timeout,
// headers: this.headers,
// retry: {
// minTimeout: this.timeout,
// maxTimeout: Infinity,
// retries: this.retries
// },
// version: '*'
// });
logger.debug(correlationId, 'Connected via REST to %s', [uri]);
} catch (err) {
client = null;
throw ConnectionException(correlationId, 'CANNOT_CONNECT',
'Connection to REST service failed')
.wrap(err)
.withDetails('url', uri);
}
}