1
votes

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;
    }


}




1
What is Artemis version ? It should work since the createContext(int sessionMode) exists on ActiveMQConnectionFactory and this is what JmsPoolConnectionFactory is looking for by reflection.ehsavoie

1 Answers

3
votes

I believe the message here is referring to the javax.jms.ConnectionFactory interface on the classpath, not the ActiveMQ Artemis implementation of javax.jms.ConnectionFactory. Therefore, you should check to see what version JMS API is on the classpath. This is the dependency that ActiveMQ Artemis uses:

<dependency>
   <groupId>org.apache.geronimo.specs</groupId>
   <artifactId>geronimo-jms_2.0_spec</artifactId>
   <version>1.0-alpha-2</version>
</dependency>