I'm using ActiveMQ(v5.1) jca adapter in Resin 3.1 snapshot0331.

In my topic producer I manually create a JmsSesion and JmsConnection using 
JmsFactory and send a TextMessage, then close the connection explicitly.
In my message driven bean I did not inject anything because resin should be 
responsible to call onMessage() method when there is a new message in topic.

I've met the 6h max-active-time problem.

After server running for 6 hours, it prints a log message:
closing pool item from active timeout:PoolItem[activemq, 0, 

I think it should be the container, which eventually invoked message driven 
bean when topic has new message, closed the connection when a timeout happened.

My questions:
1. How could I configure the "max-active-time" to a fairly long time for 
com.caucho.jca.ConnectionPool. I've googled around and found no useful info. I 
only knew how to do it for DBPool within <database> config tag. Is there any  
"max-active-time" attr could be placed within  <resource-adapter> or  
2. I felt strange that I have to create a new JmsConnection and JmsSession when 
producing a message, but need not to do it when consuming it. I think there 
should be a easy way to producing a message using resin IoC, eliminating the 
JmsConnection/JmsSession stuff.

My current config is as below:
 <resource-adapter uri="activemq:">
  <init server-url="tcp://"/>
 <connection-factory uri="activemq:" name="activemq"/>
 <jms-topic uri="activemq:" name="clearCache">
  <init physicalName="topic.clearCache"/> <!-- NOTE: There should be a resin 
documentation error: should be "physicalName", not "physical-name" -->
 <ejb-message-bean class="com.buysou.cache.ClearCacheListener">

My topic producer code:
 Topic clearCacheTopic;
 ConnectionFactory jmsFactory;
 public void sendClearCacheMessage() {
  Connection conn = null;
  try {
   conn = jmsFactory.createConnection();
   Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageProducer producer = session.createProducer(clearCacheTopic);
   producer.send(session.createTextMessage("Clear cache at " + 
DateUtils.toDateTimeString(new Date())));
  } catch (JMSException e) {
  } finally {
   try {
   } catch (Throwable ignore) {


My message driver bean code:
public class ClearCacheListener implements MessageListener {
 private static final Log log = LogFactory.getLog(ClearCacheListener.class);

 public void onMessage(Message message) {
  try {
   if (message instanceof TextMessage) {
    TextMessage txtMsg = (TextMessage) message;
   } else if (message instanceof ObjectMessage) {
    ObjectMessage objMessage = (ObjectMessage) message;
  } catch (JMSException e) {


I tried the Resin's own JDBC queue and found it corrupt. I could only produce a 
message, and found the message inserted into database. But my message driven 
bean was never invoked.

resin-interest mailing list

Reply via email to