activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dejan Bosanac <de...@nighttale.net>
Subject Re: AMQ + Programmatic Creation of Destinations + Registration in JNDI
Date Tue, 04 Aug 2009 14:53:24 GMT
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 <jworkman@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 <jworkman@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.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message