Fail to connect to queue with Immutant messaging

Currently I have an instance of ActiveMQ running, that I am attempting to connect to using immutant. Currently the code for this connection looks like so;

(defn make-ctx
  (log/debug "making context")
  (let [ctx (m/context :host (:host immutant-host) :port (:port immutant-host))]
    (log/debug "context created")

(defn make-listener
  (let [listener (m/listen topic #(log/debug %) :context ctx)]
    (log/debug "listener created")

(defn immutant-test
  (log/debug "testing immutant messaging with ActiveMQ")
  (let [ctx (make-ctx)
        listener (make-listener ctx)]
  (Thread/sleep 15000)
  (.close listener)))

Though my code does not make it passed the make-ctx function. When it attempts to create the context I get the error

Exception in thread "main" java.lang.RuntimeException: javax.jms.JMSException: Failed to create session factory
    at org.projectodd.wunderboss.messaging.jms.DestinationUtil.mightThrow(
    at org.projectodd.wunderboss.messaging.jms.JMSMessagingSkeleton.createContext(
    at org.projectodd.wunderboss.messaging.jms.JMSMessagingSkeleton.createContext(
    at immutant.messaging$context.doInvoke(messaging.clj:84)
    at clojure.lang.RestFn.invoke(
    at jms_test.core$make_ctx.invoke(core.clj:24)
    at jms_test.core$immutant_test.invoke(core.clj:37)
    at jms_test.core$_main.invoke(core.clj:158)
    at clojure.lang.AFn.applyToHelper(
    at clojure.lang.AFn.applyTo(
    at jms_test.core.main(Unknown Source)
Caused by: javax.jms.JMSException: Failed to create session factory
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnection(
    at org.projectodd.wunderboss.messaging.jms.JMSMessagingSkeleton$
    at org.projectodd.wunderboss.messaging.jms.DestinationUtil.mightThrow(
    ... 10 more
Caused by: HornetQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=HQ119013: Timed out waiting to receive cluster topology. Group:null]
    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(
    at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(
    ... 14 more

The immutant-host is defined as

(def immutant-host {:host "" :port 61616})

I've been able to connect to my broker with the clamq libray ,and am able to send and receive messages with that. Though because the rest of the application is built with immutant messaging I'd like to stick with that library if possible to keep from having to support several messaging libraries.


  • Immutant is built on top of HornetQ, so can only connect to HornetQ servers by default. This is because the JMS spec doesn't provide a wire protocol, so each implementation has its own. However, if the remote ActiveMQ is actually Artemis, you can use wunderboss-artemis to enable using it from Immutant (note that the article states you have to use an incremental build of Immutant - that is no longer true, you can use Immutant 2.1.0).

    If it's not Artemis, it wouldn't be too difficult to implement a wunderboss-activemq adapter using the artemis version as a guide.