use of org.apache.camel.component.cm.exceptions.HostUnavailableException in project camel by apache.
the class CMProducer method doStart.
@Override
protected void doStart() throws Exception {
// log at debug level for singletons, for prototype scoped log at trace
// level to not spam logs
log.debug("Starting CMProducer");
final CMConfiguration configuration = getConfiguration();
if (configuration.isTestConnectionOnStartup()) {
try {
log.debug("Checking connection - {}", getEndpoint().getCMUrl());
HttpClientBuilder.create().build().execute(new HttpHead(getEndpoint().getCMUrl()));
log.debug("Connection to {}: OK", getEndpoint().getCMUrl());
} catch (final Exception e) {
throw new HostUnavailableException(String.format("Connection to %s: NOT AVAILABLE", getEndpoint().getCMUrl()), e);
}
}
// keep starting
super.doStart();
log.debug("CMProducer started");
}
Aggregations