Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import io.kaoto.forage.core.util.config.ConfigStore;
import io.kaoto.forage.jms.common.ConnectionFactoryCommonExportHelper;
import io.kaoto.forage.jms.common.ConnectionFactoryConfig;
import io.kaoto.forage.jms.common.ForageConnectionFactory;

@ForageFactory(
value = "JMS Connection",
Expand Down Expand Up @@ -130,8 +129,12 @@ public void configure() {
for (String name : prefixes) {
if (camelContext.getRegistry().lookupByNameAndType(name, ConnectionFactory.class) == null) {
ConnectionFactoryConfig cfConfig = new ConnectionFactoryConfig(name);
ForageConnectionFactory forageConnectionFactory = newConnectionFactory(cfConfig, name);
camelContext.getRegistry().bind(name, forageConnectionFactory.connectionFactory());
ConnectionFactory connectionFactory = newConnectionFactory(cfConfig, name);
if (connectionFactory != null) {
camelContext.getRegistry().bind(name, connectionFactory);
} else {
LOG.warn("Skipping binding for '{}' because ConnectionFactory creation returned null", name);
}
}
}
} else {
Expand All @@ -141,11 +144,8 @@ public void configure() {
final List<ServiceLoader.Provider<ConnectionFactoryProvider>> providers =
findProviders(ConnectionFactoryProvider.class);
if (providers.size() == 1) {
ForageConnectionFactory forageConnectionFactory =
doCreateConnectionFactory(providers.get(0), null);
camelContext
.getRegistry()
.bind(DEFAULT_CONNECTION_FACTORY, forageConnectionFactory.connectionFactory());
ConnectionFactory connectionFactory = doCreateConnectionFactory(providers.get(0), null);
camelContext.getRegistry().bind(DEFAULT_CONNECTION_FACTORY, connectionFactory);
} else {
throw new IllegalArgumentException(
"No ConnectionFactory implementation is present in the classpath");
Expand All @@ -157,7 +157,7 @@ public void configure() {
}
}

private synchronized ForageConnectionFactory newConnectionFactory(
private synchronized ConnectionFactory newConnectionFactory(
ConnectionFactoryConfig connectionFactoryConfig, String name) {
final String connectionFactoryProviderClass =
ConnectionFactoryCommonExportHelper.transformJmsKindIntoProviderClass(
Expand All @@ -178,10 +178,10 @@ private synchronized ForageConnectionFactory newConnectionFactory(
return doCreateConnectionFactory(connectionFactoryProvider, name);
}

private ForageConnectionFactory doCreateConnectionFactory(
private ConnectionFactory doCreateConnectionFactory(
ServiceLoader.Provider<ConnectionFactoryProvider> provider, String name) {
final ConnectionFactoryProvider connectionFactoryProvider = provider.get();
return new ForageConnectionFactory(connectionFactoryProvider.create(name));
return connectionFactoryProvider.create(name);
}

@Override
Expand Down
Loading