users@glassfish.java.net

MDB stops receiving messages

From: Per Steffensen <steff_at_designware.dk>
Date: Wed, 27 May 2009 13:04:11 +0200

Hi

I have an application with an EJB module containing a MDB consuming
messages from Active MQ. It works fine, the MDB receives the messages
and processes them correctly. At least for some time. After running for
a while the MDB suddenly stops receiving messages, even though there are
messages available on the queue - I can see that using the Active MQ
console. I can also see that Glassfish is still registered as a consumer
on the Active MQ queue, after the MDB stops recieving messages. I see
nothing in the server.log indication any errors.

Please help me find out why the MDB stops receiving messages, and please
point me to a solution.

Thanks alot!

Regards, Per Steffensen

------------------------------- setup information ----------------------

OS: Mac OSX 10.5.7
JVM: Mac 1.6.0
Glassfish: v2.1
Active MQ: 5.2.0

I have a simple MDB setup (without connection pooling (dont know exactly
how to set that up) etc.):

Resources are setup using (activemq-core-5.2.0.jar are add to the
genericra.rar):
$GLASSFISH_INSTALL/bin/asadmin deploy genericra.rar
$GLASSFISH_INSTALL/bin/asadmin create-resource-adapter-config --property
SupportsXA=true:RMPolicy=OnePerPhysicalConnection:ProviderIntegrationMode=javabean:ConnectionFactoryClassName=org.apache.activemq.ActiveMQConnectionFactory:QueueConnectionFactoryClassName=org.apache.activemq.ActiveMQConnectionFactory:TopicConnectionFactoryClassName=org.apache.activemq.ActiveMQConnectionFactory:XAConnectionFactoryClassName=org.apache.activemq.ActiveMQXAConnectionFactory:XAQueueConnectionFactoryClassName=org.apache.activemq.ActiveMQXAConnectionFactory:XATopicConnectionFactoryClassName=org.apache.activemq.ActiveMQXAConnectionFactory:UnifiedDestinationClassName=org.apache.activemq.command.ActiveMQDestination:QueueClassName=org.apache.activemq.command.ActiveMQQueue:TopicClassName=org.apache.activemq.command.ActiveMQTopic:ConnectionFactoryProperties=brokerURL\\=tcp\\://$ACTIVEMQ_HOST\\:$ACTIVEMQ_PORT:LogLevel=FINE
genericra

The application is deployed through Eclipse. Eclipse also starts
(runs/controlls) the application server.

My MDB looks something like this:
@TransactionManagement(TransactionManagementType.CONTAINER)
@MessageDriven(name = "UserHandlerMDB"
// ,activationConfig = { }
)
public class UserHandlerMDB implements MessageListener
{
    public void onMessage(Message arg0) {
        ...
    }
}

My sun-ejb-jar.xml looks something like this (the activation-configs not
carefully set up - dont know exactly how to set them up to get the best
performance, but I will find out):
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sun-ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Application
Server 8.1 EJB 2.1//EN'
'http://www.sun.com/software/sunone/appserver/dtds/sun-ejb-jar_3_0-0.dtd'>

<!-- Copyright 2002 Sun Microsystems, Inc. All rights reserved. -->

<sun-ejb-jar>
 <enterprise-beans>
   <unique-id>1</unique-id>
   <ejb>
     <ejb-name>UserHandlerMDB</ejb-name>
     <mdb-resource-adapter>
       <resource-adapter-mid>genericra</resource-adapter-mid>
       <activation-config>
        <activation-config-property>
          
<activation-config-property-name>DestinationType</activation-config-property-name>
          
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
          
<activation-config-property-name>DestinationProperties</activation-config-property-name>
          <activation-config-property-value>PhysicalName=UserHandler
RQ</activation-config-property-value>
       </activation-config-property>
       <activation-config-property>
         
<activation-config-property-name>MaxPoolSize</activation-config-property-name>
         
<activation-config-property-value>32</activation-config-property-value>
       </activation-config-property>
       <activation-config-property>
         
<activation-config-property-name>RedeliveryAttempts</activation-config-property-name>
         
<activation-config-property-value>0</activation-config-property-value>
       </activation-config-property>
       <activation-config-property>
         
<activation-config-property-name>ReconnectAttempts</activation-config-property-name>
         
<activation-config-property-value>4</activation-config-property-value>
       </activation-config-property>
       <activation-config-property>
         
<activation-config-property-name>ReconnectInterval</activation-config-property-name>
         
<activation-config-property-value>10</activation-config-property-value>
       </activation-config-property>
       <activation-config-property>
         
<activation-config-property-name>RedeliveryInterval</activation-config-property-name>
         
<activation-config-property-value>1</activation-config-property-value>
       </activation-config-property>
       <activation-config-property>
         
<activation-config-property-name>SendBadMessagesToDMD</activation-config-property-name>
         
<activation-config-property-value>false</activation-config-property-value>
       </activation-config-property>
      </activation-config>
     </mdb-resource-adapter>
   </ejb>
 </enterprise-beans>
</sun-ejb-jar>