I am trying to get Camel to play nicely with Artemis and connection pools. I am using the following tech stack.
- Springboot: 2.3.1.RELEASE
- Camel: 3.4.1
The connection pool is created using the following dependencies:
- org.messaginghub.pooled-jms.JmsPoolConnectionFactory
- org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory
I am still seeing the message during startup:
o.m.pooled.jms.JmsPoolConnectionFactory : JMS ConnectionFactory on classpath is not a JMS 2.0+ version
The connection factory is from the Artemis code base so not sure why the JmsPoolConnectionFactory is saying this.
See my code below:
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.camel.component.jms.JmsComponent;
import org.apache.camel.component.jms.JmsConfiguration;
import org.messaginghub.pooled.jms.JmsPoolConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.jms.JMSException;
@Configuration
public class ApplicationConfiguration {
private ActiveMQConnectionFactory connectionFactory = new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory();
@Bean
public JmsComponent jms() throws JMSException {
// Create the connectionfactory which will be used to connect to Artemis
connectionFactory.setBrokerURL("(tcp://artemo-activemq-artemis-master-0.artemo-activemq-artemis-master.default.svc.cluster.local:61616,tcp://artemo-activemq-artemis-master-1.artemo-activemq-artemis-master.default.svc.cluster.local:61616)");
connectionFactory.setUseTopologyForLoadBalancing(true);
connectionFactory.setUser("artemis");
connectionFactory.setPassword("artemis");
connectionFactory.setConsumerWindowSize(8388608);
JmsPoolConnectionFactory pooledConnectionFactory = new JmsPoolConnectionFactory();
pooledConnectionFactory.setMaxConnections(16);
pooledConnectionFactory.setConnectionFactory(connectionFactory);
JmsConfiguration jmsConfiguration = new JmsConfiguration();
jmsConfiguration.setConcurrentConsumers(16);
jmsConfiguration.setArtemisStreamingEnabled(true);
jmsConfiguration.setTransacted(true);
jmsConfiguration.setConnectionFactory(pooledConnectionFactory);
// Create the Camel JMS component and wire it to our Artemis connectionfactory
JmsComponent jms = new JmsComponent();
jms.setConfiguration(jmsConfiguration);
return jms;
}
}