activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: Configuring Destinations in activemq's JNDI initial Context
Date Thu, 22 Mar 2012 15:24:46 GMT
The ActiveMQ initial context is really just an in-memory hash map, it
does not know about the broker.

You could remove the values to the external jndi.properties file so
they are externalized from the client code.

Destinations in activemq are created on demand, they don't need to be
pre configured,
so another option is to use the dynamicQueue context[1] to look up a
destination, this requires changing the name that the client uses for
the destination lookup however.

The third option is to extend the ActiveMQInitialContextFactory to do
what you need, an maybe have the root context be dynamic, so that any
lookup results in a queue. It may be necessary to differentiate topics
and queues though in some way.

[1] http://activemq.apache.org/jndi-support.html#JNDISupport-Dynamicallycreatingdestinations


On 22 March 2012 09:28, craigwarren <craig.warren@aquilauk.co.uk> wrote:
> Hi,
>
> I'm trying to create an application which uses JMS message queues, but in
> order to support production and development environment I need to be able to
> use both Apache ActiveMQ and Oracle AQ.
>
> I use spring to do jndi lookups of the destinations... below is the configI
> use when connecting to Oracle AQ:
> <jee:jndi-lookup id="handlersDest"  jndi-name="handlersDest">
>    <jee:environment>
>        java.naming.factory.initial = weblogic.jndi.WLInitialContextFactory
>        java.naming.provider.url = ${jndi.jms.naming.url}
>        queue.handlersDest = t3://localhost:7001
>    </jee:environment>
> </jee:jndi-lookup>
>
> But when I connect to ActiveMQ I have to add an extra property to the
> environment:
> <jee:jndi-lookup id="handlersDest"  jndi-name=handlersDest>
>    <jee:environment>
>        java.naming.factory.initial =
> org.apache.activemq.jndi.ActiveMQInitialContextFactory
>        java.naming.provider.url = tcp://0.0.0.0:61616
>        queue.handlersDest = handlersDest
>    </jee:environment>
> </jee:jndi-lookup>
>
> The extra property (queue.handlersDest = handlersDest) seems to be asking
> activeMQ to put the queue physically named "handlersDest" in the jndi name
> "queue.handlersDest". I want to know if there is any way this can be done in
> advance, and not by the client using the destination.
>
> Can I configured activemq.xml to pre-set this naming? I would rather not
> have that property in my client application if I can avoid it.
>
> Craig
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Configuring-Destinations-in-activemq-s-JNDI-initial-Context-tp4494989p4494989.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
http://fusesource.com
http://blog.garytully.com

Mime
View raw message