camel-activemq (CAMEL ON EAP DEPLOYMENT) not working as described

Latest response

Hi,

the documentation for the ACTIVEMQ component [1] describes the possibility of a route deployed on EAP to connect to a remote A-MQ broker using the 'org.apache.activemq.ActiveMQConnectionFactory' in conjunction with 'org.apache.activemq.pool.PooledConnectionFactory'. But when you try this approach you end up facing some class loader issues. This happens because the camel modules configured by FuseOnEAP installer (I tested with Fuse 6.3 r3 on EAP 6.4.15) hides the activemq api. See modules/system/layers/fuse/org/apache/activemq/main/module.xml


<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="org.apache.activemq"> <properties> <property name="jboss.api" value="private" /> </properties> <resources> <resource-root path="activemq-broker-5.11.0.redhat-630262.jar" /> <resource-root path="activemq-client-5.11.0.redhat-630262.jar" /> <resource-root path="activemq-jms-pool-5.11.0.redhat-630262.jar" /> <resource-root path="activemq-openwire-legacy-5.11.0.redhat-630262.jar" /> <resource-root path="activemq-pool-5.11.0.redhat-630262.jar" /> <resource-root path="activemq-spring-5.11.0.redhat-630262.jar" /> </resources>

the hides the activemq client from the deployed camel application on EAP. On the other hand if you declares the camel-activemq dependencies on your pom.xml:

    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-client</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-pool</artifactId>
      <scope>provided</scope>
    </dependency>

You will face some classloading conflicts:

    ... 35 more
Caused by: java.lang.ClassCastException: org.apache.activemq.transport.discovery.DiscoveryTransportFactory cannot be cast to org.apache.activemq.transport.TransportFactory
    at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:179) [activemq-client-5.11.0.redhat-630262.jar:5.11.0.redhat-630262]
    ... 37 more

So, the docs need to be clear about the right approach when connecting to a remote A-MQ broker from Camel Routes deployed on top of FuseOnEAP 6. I mean, via AMQ Resource Adapter or via Activemq client (remote protocols).

[1] https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html/apache_camel_component_reference/idu-activemq

Responses