Hi Dejan - the below example will work fine, however, it doesn't solve our
need. We need to be able to create queues and topics programmatically
(createQueue) and I want to avoid having to write something out to
jndi.properties to do this. Also, most of our lookups currently have "/"'s
in the name and I found you can't easily do this, like: queue/domain/qname =
some/physical/name 


A little more background: we were using jboss mq to handle messaging, but
after some debate decided to move away. Jboss would force us to write out a
mbean xml containing the queue or topic and that would be accessible in jndi
lookups. I really like ActiveMQ but as I have said we have to be able to
create queues & topics in code and support the ability to find them by doing
jndi lookups -- without having to manually bounce the server or otherwise
append to some properties file. 

Hope that helps in clarity...


Dejan Bosanac wrote:
> 
> Hi Jason,
> 
> can you try specifying
> 
> queue.MyQueue = domainname/queuename
> 
> in your jndi.properties
> 
> and use
> 
> queue = (Queue) ctx.lookup("MyQueue");
> 
> in your Java app. The same should work for topics as well.
> 
> 
> Cheers
> --
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 
> 
> On Tue, Aug 4, 2009 at 4:42 PM, jworkman <jwork...@oidev.com> wrote:
> 
>>
>> Yes I read the section, but it explains about adding it to the
>> jndi.properties file, which I can do for predefined ones but not ones
>> created in memory (I need something similar to session.createQueue but
>> accessible through jndi lookups to keep the api portable).
>>
>> dynamicQueues/ don't seem to work when I try to connect from an external
>> client.
>>
>> My jndi properties:
>>
>>
>> java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
>> java.naming.provider.url=tcp://xxxxxx:61616
>> java.naming.referral=throw
>> java.naming.factory.object=ConnectionFactory
>>
>> Queue name I am trying to create:
>>
>> domainname/queuename
>>
>>
>> Thanks for your assistance...
>>
>> Jason
>>
>>
>> James.Strachan wrote:
>> >
>> > 2009/8/4 jworkman <jwork...@oidev.com>:
>> >>
>> >> I really need help, I am struggling to create queues and topics in
>> >> ActiveMQ
>> >> and have them accessible from JNDI lookups. I need this
>> >> creation/registration to be done without bringing the server down, and
>> >> done
>> >> without manual configuration.
>> >>
>> >> Something like:
>> >>
>> >> //create the jndi context
>> >> InitialContext jndiContext = new
>> InitialContext(loadConnectionProps());
>> >>
>> >> // Create a ConnectionFactory
>> >> ConnectionFactory connectionFactory = (ConnectionFactory)
>> >>
>> jndiContext.lookup(loadConnectionProps().getProperty(Context.OBJECT_FACTORIES));
>> >>
>> >> // Create a Connection
>> >> Connection connection = connectionFactory.createConnection();
>> >>
>> >> // Create a Session
>> >> Session session = connection.createSession(false,
>> >> Session.AUTO_ACKNOWLEDGE);
>> >>
>> >> // Create the destination (Topic or Queue)
>> >> session.createQueue(qname);
>> >>
>> >> ************this below doesn't work***********
>> >>
>> >> //get the topic from jndi
>> >> topic = (Topic) ctx.lookup(name);
>> >
>> > What names are you looking up?
>> >
>> > Did you read the section on "Dynamically creating destinations" here?
>> > http://activemq.apache.org/jndi-support.html
>> >
>> >
>> > --
>> > James
>> > -------
>> > http://macstrac.blogspot.com/
>> >
>> > Open Source Integration
>> > http://fusesource.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/AMQ-%2B-Programmatic-Creation-of-Destinations-%2B-Registration-in-JNDI-tp24809685p24809919.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> Dejan Bosanac
> 
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
> 

-- 
View this message in context: 
http://www.nabble.com/AMQ-%2B-Programmatic-Creation-of-Destinations-%2B-Registration-in-JNDI-tp24809685p24810403.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to