I need to use activemq-client rather than the roll-up activemq-all JAR files because the roll-up all contains different versions of other libraries we use.
I'm using maven to manage dependencies, the client jar pulls in:
- activemq-client (5.15.8)
- slf4j-api 1.7.25
- geronimo-jms_1.1_spec (1.1.1)
- hawtbuf (1.11)
- geronimo-j2ee-management_1.1_spec (1.0.1)
The all jar is just activemq-all (5.15.8)
Using this code, with the activemq-all jar, I can connect and start receiving messages. At the createConnection()
call, I get a log message "Successfully connected to ..."
Using the activemq-client jar, it hangs at the createSession()
call (and outputs a "failed after 10 attempts, will continue trying" message). I do not get the "Successfully connected to ..." message.
ConnectionFactory factory = new ActiveMQConnectionFactory(user, pass, url);
Connection AMQconn = factory.createConnection();
Session AMQsess = AMQconn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = AMQsess.createQueue(queueName);
MessageConsumer AMQconsumer = AMQsess.createConsumer(queue);
I assume I'm missing a dependency somewhere, but I'm not getting a no class def found
exceptions, etc.
(I also used activemq version 5.15.9, but our server is 5.15.8, so sticking with that).
The bigger picture (why the client jar vs the roll-up jar): I need to connect to a hornetQ and an AMQ in the same process, and breaking out the individual jars is my attempt at fixing conflicting versions of things in the roll-up jars)