Skip to main content

Connecting to ActiveMQ

For connection to ActiveMQ:

  • JMS_broker_URL for ActiveMQ has the following structure:

    tcp://<host>:<port>
  • connection_factory_class_name should be org.apache.activemq.jndi.ActiveMQInitialContextFactory.

  • connection_factory_name is usually ConnectionFactory.

  • variant should take the jndi or jndi-topic value to connect to a queue or a topic respectively. However, queue or topic work also for ActiveMQ.

In case of connection to a dynamic queue/topic, the destination name needs to be prefixed with dynamicQueues/ or dynamicTopics/ respectively.

Below is an example of connection to a ActiveMQ dynamic queue called "test.queue" with a broker running on the localhost port 61616:

ActiveMQ connection to queue URI

jms:jndi:dynamicQueues/test.queue?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&jnd
iConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61616

Below is an example of connection to the dynamic topic "test.topic" with the broker running on localhost port 61616:

ActiveMQ connection to a topic URI

jms:jndi-topic:dynamicTopics/test.topic?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory&jnd
iConnectionFactoryName=ConnectionFactory&jndiURL=tcp://localhost:61616

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!