use of org.apache.camel.support.LoggingExceptionHandler in project camel by apache.
the class SjmsEndpoint method createConnectionResource.
protected ConnectionResource createConnectionResource(Object source) {
if (getConnectionFactory() == null) {
throw new IllegalArgumentException(String.format("ConnectionResource or ConnectionFactory must be configured for %s", this));
}
try {
logger.debug("Creating ConnectionResource with connectionCount: {} using ConnectionFactory", getConnectionCount(), getConnectionFactory());
// We always use a connection pool, even for a pool of 1
ConnectionFactoryResource connections = new ConnectionFactoryResource(getConnectionCount(), getConnectionFactory(), getComponent().getConnectionUsername(), getComponent().getConnectionPassword(), getComponent().getConnectionClientId(), getComponent().getConnectionMaxWait(), getComponent().isConnectionTestOnBorrow());
if (exceptionListener != null) {
connections.setExceptionListener(exceptionListener);
} else {
// add a exception listener that logs so we can see any errors that happens
ExceptionListener listener = new SjmsLoggingExceptionListener(new LoggingExceptionHandler(getCamelContext(), source.getClass()), isErrorHandlerLogStackTrace());
connections.setExceptionListener(listener);
}
connections.fillPool();
return connections;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
Aggregations