On Aug 8, 2006, at 6:05 PM, avin98 wrote:
Temporarily I have used the following to solve my problem:
Its ugly and I don't want to have this as my permanent solution,
since I
have no control over the ActiveMQ connection pool etc etc.
String hostName = "server2";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.activemq.jndi.ActiveMQInitialContextFactory");
env.put(Context.PROVIDER_URL, "tcp://" + hostName + ":61616");
env.put(Context.SECURITY_PRINCIPAL, "geronimo");
env.put(Context.SECURITY_CREDENTIALS, "geronimo");
String queue1= "dynamicQueues/Queue1";
String connFactory = "ConnectionFactory";
InitialContext naming = new InitialContext(env);
QueueConnection queueConnection;
QueueConnectionFactory factory = (QueueConnectionFactory)
naming.lookup(connFactory);
queueConnection = factory.createQueueConnection();
Queue queue = (Queue)naming.lookup(queue1);
System.out.println("getting a Q connection"+queueConnection);
QueueSession publishSession =
queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
// Get a Queue Sender
QueueSender sender = publishSession.createSender(queue);
System.out.println("Sender:" + sender);
This works for me, but I have no control over the connection Pool.....
I think you are running without a connection pool in this scenario,
although I'm not certain about how this jndi context is configured so
there might be some pooling going on. It's certainly not configured
in geronimo and I don't think it's using geronimo connection
management or hooked in with the transaction manager.
Basically I don't even know what "ConnectionFactory" is all about ?
All that
I know is that its an ActiveMQConnectionFactory ....thats all.
I am not even sure, how its bound to the Geronimo JNDI app tree etc.
It isn't bound into geronimo jndi, you are explicitly using the amq
jndi.
Any other ways to achieve the same this.
I don't think you want to achieve this result :-) I think you want
connection pooling.
David - I need to have the activeMQ brokers turned on on both the
machines.
The important part of the solution I recommended is that you deploy
the amq rar with a geronimo plan that points it to the other machine
and includes the connection factory and admin objects you need to
use. It doesn't really matter how many amq brokers are running on
"this" machine -- could be 0, 1, 25 or 50 -- just that the connection
factory you use is connecting to the amq broker on the other machine.
Did you run into a problem trying my suggestion?
thanks
david jencks
--
View this message in context: http://www.nabble.com/JNDI-Lookup-
tf2074678.html#a5718096
Sent from the Apache Geronimo - Users forum at Nabble.com.