activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Hixson <hix...@poindextrose.org>
Subject making queues findable from InitialContext.lookup(name)
Date Tue, 27 Oct 2009 23:15:28 GMT
Properties props = new Properties();
props
.setProperty
(Context
.INITIAL_CONTEXT_FACTORY
,"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61616");
InititalContext ic = new InitialContext(props));
QueueConnectionFactory factory =  
(QueueConnectionFactory)ic.lookup("queueConnectionFactory");
QueueSession jmsSession = jmsConnection.createQueueSession(false,  
javax.jms.Session.AUTO_ACKNOWLEDGE);
Queue jmsqueue = (javax.jms.Queue)ic.lookup("dynamicQueues/" +  
QUEUE_NAME);


I have the above code working to get a queue that is not defined in my  
jndi.properties.  If I configure the queue in jndi.properties then I  
don't need the "dynamicQueues/" to proceed QUEUE_NAME.
   What I'm doing is trying to replace a proprietary JMS server with  
ActiveMQ.  It looks as if this other software makes all of its queues  
available through the InitialContext.  So our existing code finds  
already existing queues in the JMS server just by doing:

Queue jmsqueue = (javax.jms.Queue)ic.lookup(QUEUE_NAME);

So it would be Very Convenient if I could get ActiveMQ to do the same  
thing so that we don't have to dredge through our codebase modifying  
every call to ic.lookup().
   Is it possible to get that behavior through an ActiveMQ  
configuration?  If not then I suppose I could modify the ActiveMQ  
source to prepend "dynamicQueues/" to any queue name it is asked to  
lookup, but I'd rather not do that if its not necessary.
  Thanks,
   -M@

Mime
View raw message