Configuring ActiveMQ for JNDI
The examples in this book all use JNDI to connect to the JMS provider and obtain the JMS destinations (queues and topics). Therefore, you will need to create a jndi.properties file for each example. This property file contains the connection information, connection factory names, and destination names used by the sample code in each chapter. The code in this book is designed to be run with a centralized broker model, meaning that there is a separate and distinct JMS server running in its own JVM that JMS clients connect to.
In keeping with the spirit of the Java platform, we chose to use JNDI in the examples to make the source code JMS provider agnostic, allowing you to use any JMS provider supporting JNDI (as most do). In general, the jndi.properties file for the sample code in the book will require six properties to be set:
java.naming.factory.initialThe initial context factory specific to each provider
java.naming.provider.urlThe protocol, address, and port of the JMS provider
java.naming.security.principalThe user ID used to connect to the JMS provider
java.naming.security.credentialsThe password used to connect to the JMS provider
connectionFactoryNamesThe name(s) of the connection factory used to obtain JMS connections
topic.<topicname>(orqueue.<queuename>)The JNDI name of the destination object (queue or topic)
ActiveMQ contains a configuration file located in the ACTIVEMQ_HOME/conf directory called activemq.xml. This file contains most of the configuration ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access