In my application I'm using a library which uses JNDI to locate JMS topics
and then operates with them.

I successfully configured JNDI references to the JMS topics like this in
Context.xml, and everything works nicely:

    <Resource name="jms/flex/TopicConnectionFactory"
              type="org.apache.activemq.ActiveMQConnectionFactory"
              description="JMS Connection Factory"
              factory="org.apache.activemq.jndi.JNDIReferenceFactory"
              brokerURL="tcp://localhost:61616"
              brokerName="activeMQBroker" />

    <Resource name="jms/gds1"
              type="org.apache.activemq.command.ActiveMQTopic"
              description="Discussion topic for GraniteDS"
              factory="org.apache.activemq.jndi.JNDIReferenceFactory"
              physicalName="test.gds1"
              />

The challenge is that the JMS topics I want to make available to the library
depend on some runtime information, i.e. I want my application to create the
JMS topics dynamically. Is there a way that I can create these JNDI
resources at runtime from my application instead of having to hard-code them
into Context.xml? I'm able to upgrade to Tomcat 7 if necessary.
I found this, not sure if it could solve my problem?
http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#Adding_Custom_Resource_Factories
.

I'm no expert on JNDI so if there is an altogether better solution to my
problem I'm open to it.

John

Reply via email to