ActiveMQ Queue JNDI Publisher Consumer

ActiveMQ Queue JNDI Publisher Consumer

In last tutorial you saw how to print Hello World using ActiveMQ. Today we will extend ActiveMQ Hello World to use JNDI to lookup javax.jms.ConnectionFactory rather than creating ActiveMQConnectionFactory directly. All steps of installation, start and stop process are same.

  • To use JNDI first you will have to create jndi.properties file and keep in project classpath. To show how to do this we will create simple maven project. Below is final project structure:

ActiveMQ Queue JNDI Publisher Consumer

  • pom.xml:

  • jndi.properties file:

  • ActiveMQTopicExampleUsingJNDI.java

  • Output:

ActiveMQ Queue JNDI Publisher Consumer

  • For more information please read ActiveMQ getting started tutorial here

Leave a Reply

Your email address will not be published. Required fields are marked *