Question

My original problem is an attempt to discover and embed HornetQ with a bare minimum of dependencies.

One item i would like to avoid is the need for JNDI. I believe it should be possible locate all the objects directly rather than doing the jndi locator thing.

I am not a fan of jndi because it seems to be like a global bucket of crap, where one needs to keep track of names, make sure they dont conflict w/ other things and so on, many things which seem wrong when one remembers that good abstractions make a bare minimum public.

BTW this is not a rant just a general observation...

Was it helpful?

Solution

I found an answer to my own q while browsing the examples particularly EmbeddedExample.java which says "yes" one can does not need JNDI..

 // Step 1. Create the Configuration, and set the properties accordingly
     Configuration configuration = new ConfigurationImpl();
     configuration.setPersistenceEnabled(false);
     configuration.setSecurityEnabled(false);
     configuration.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));

     // Step 2. Create and start the server
     HornetQServer server = HornetQServers.newHornetQServer(configuration);
     server.start();

     // Step 3. As we are not using a JNDI environment we instantiate the objects directly
     ClientSessionFactory sf = HornetQClient.createClientSessionFactory(new TransportConfiguration(InVMConnectorFactory.class.getName()));

     // Step 4. Create a core queue
     ClientSession coreSession = sf.createSession(false, false, false);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top