activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdiasfreitas <>
Subject PooledConnectionFactory per session
Date Fri, 30 Mar 2012 18:47:29 GMT
We have the following use case:

1) We are using Apache + Coldfusion as application server;
2) Many logged users may need to send a message to the Coldfusion Server,
and the Coldfusion Server, after doing some validations, will format a
MapMessage and put on the Queue;
3) Coldfusion is serving up to 100 simultaneous requests, under heavy load.
4) We need to have the lowest latency in this process.

At this moment, for each message we are opening a new connection, creating a
session, a producer, sending the message, closing the session, closing the

Of course this is not the proper way to do this.

I was studying the PooledConnectionFactory, and I need some clarification
about the proper way to make this: 

PooledConnectionFactory pool = new PooledConnectionFactory(
pool.setMaxActive(5); // 10*5 = 10 threads on the server, with 5
simultaneous sessions

The variable pool is made static, and it's a server variable. Access to it
is synchronized.

Everytime I need to send a message, I call:

con = pool.createConnection();
Session session = con.createSession( xxxx );
MessageProducer producer =
MapMessage message = session.createMapMessage();
message.setString('aaaa', 'bbbbb');

Please, help me with:

1) Is this approach correct?
2) I could not find any place to have pooled SESSIONS instead of
CONNECTIONS. This would free us from the overhead of creating a session,
producer, etc... 

Any comments will be highly appreciated.


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message