activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <james.strac...@gmail.com>
Subject Re: AMQ + Programmatic Creation of Destinations + Registration in JNDI
Date Tue, 04 Aug 2009 14:32:54 GMT
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/

Mime
View raw message