Configuration For Chat Examples
To run the Chat application
found in Chapter 2, you will need to create a
jndi.properties file (located in your classpath)
with the connectionFactoryNames
property set to TopicCF and the
topic.topic1 property set to jms.topic1:
java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory java.naming.provider.url = tcp://localhost:61616 java.naming.security.principal=system java.naming.security.credentials=managerconnectionFactoryNames = TopicCFtopic.topic1 = jms.topic1
The jndi.properties file also contains the
JNDI connection information for the JMS provider. You will need to set
the initial context factory class, provider URL, username, and password
needed to connect to the JMS server. To run the examples using ActiveMQ
you would set the initial context factory to org.apache.activemq.jndi.ActiveMQInitialContextFactory
and the provider URL to tcp://localhost:61616 (the default protocol,
host, and port for ActiveMQ (as shown earlier).
You will also need to define the topic used by the Chat application, called topic1. This is defined this in the
activemq.xml file located in the
ACTIVEMQ_HOME/conf directory. You will need to add a destinations element to the base configuration
as shown here:
... <destinations> <topic name="topic1" physicalName="jms.topic1" /> </destinations> ...
In addition to the configuration changes indicated here, you will need to include the activemq-all-5.2.0.jar file in your classpath.
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