|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
knowing connection pool size in my program |
« View previous topic :: View next topic » |
Author |
Message
|
chanchal |
Posted: Thu Apr 08, 2004 9:03 am Post subject: knowing connection pool size in my program |
|
|
Apprentice
Joined: 30 Jan 2004 Posts: 38
|
Hey,in my project,I am recieving JMS messages asynchronously.It works fine but actually i m using connection/session pooling for listeners and I need to know the size of connection pool in my onMessage method for some task.But the problem is that my following loop is iterating through listeners to create connection/sessions for them and as soon as it reaches at line#20(See in my program,i mentioned line# for your understanding).it goes to onmessage method because I am registering listeners from that class.so loop doesn't get complete before calling onmessage method and hence i dont come to know about the size of connection pool in onmessage method.Any idea how to know the size of connection pool before calling onmessage method in my program??Here is my loop and the entire thing works fine if i dont use the connection pool size in onmessage method but without knowing the size I need to hard-code at one place and I want to remove that hard-coding.
-----------------------------------------------------------------------------------
// Iterate over registered listeners to create connections/sessions
for(int i=0; i<listeners.length;i++){
listener = listeners[i];
name = listener.getQmgrName();
host = listener.getHost();
nameArray.add(name);
try {
MQQueueConnectionFactory qcf =new com.ibm.mq.jms.MQQueueConnectionFactory();
qcf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
qcf.setQueueManager(name);
qcf.setHostName(host);
qcf.setPort(1414);
qcf.setUseConnectionPooling(true);
qcf.setChannel("JAVA.CHANNEL");
String qName = listener.getRqstQueue();
// Obtain a QueueConnection
QueueConnection conn = qcf.createQueueConnection();
queueConnPool.put(name,conn);
// Create a ServerSessionPool using our simple MyServerSessionPool implementation
//In this method call, I am creating sessions,and registering the listeners to receive messages asynchronously
(line#20) MyServerSessionPool ssp =
new MyServerSessionPool( conn,listener.getSessionPoolSize(),Session.AUTO_ACKNOWLEDGE,listener );
// Finally, get a ConnectionConsumer and then start things going by
// starting the connection
LOG.info("Starting Connection... " + conn + " for " + qName);
conn.start();
}
} catch (Exception ex) {
LOG.warn("Error creating server session pool for " + listener,ex );
throw ex;
}
} |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|