You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Doug Bryant <do...@netinlet.com> on 2007/06/04 16:37:15 UTC

ActiveMQ hangs when trying to push messages in a loop?

As a proof of concept for further development down this avenue, I created an
Echo mdb and started it listening on a queue.  I needed to be able to send
messages from ruby classes and can do that via stomp.

The Echo mdb simply does a System.out.println("ECHO: " + theMessage);

I am able to send individual messages successfully.  However, when I try to
send messages in a loop, the Echo mdb processes 3 messages then hangs.  I
receive no errors or anything.  When I go to shutdown activemq, it is
unresponsive after the Connectors are stopped and has to be killed (kill
-KILL xxx).

My setup is as follows.
* I added the necessary items to activemq.xml to get the mdb to start
listening upon activemp startup.
* using jencks.  config is basically straight out of the jencks examples.
(see below what is added to activemq.xml)

Would anyone have an idea why it hangs when trying to send messages while in
a loop?

This is how I am sending messages through stomp. "random_text" is a  method
which returns a random string from an array of strings
10.times { @con.send "/queue/test.InboundA", random_text , {'persistent' =>
'true'} }


       <bean id="transactionManager" class="
org.jencks.factory.TransactionManagerFactoryBean"/>
        <!--
        || Jencks JCA Container
        -->
        <bean id="jencks" class="org.jencks.JCAContainer">
          <property name="transactionManager" ref="transactionManager"/>
          <property name="threadPoolSize" value="25"/>

          <!-- the JCA Resource Adapter -->
          <property name="resourceAdapter">
            <bean id="activeMQResourceAdapter" class="
org.apache.activemq.ra.ActiveMQResourceAdapter">
                    <property name="serverUrl"
value="vm://localhost?broker.persistent=false"/>
            </bean>
          </property>
        </bean>

        <!--
          || an inbound message connector using a stateless, thread safe
MessageListener
          -->
        <bean id="inboundConnectorA" class="org.jencks.JCAConnector">
          <property name="jcaContainer" ref="jencks"/>
          <!-- subscription details -->
          <property name="activationSpec">
            <bean class="org.apache.activemq.ra.ActiveMQActivationSpec">
              <property name="destination" value="test.InboundA"/>
              <property name="destinationType" value="javax.jms.Queue"/>
            </bean>
          </property>
          <property name="transactionManager" ref="transactionManager"/>
          <property name="ref" value="echoBean"/>
        </bean>

       <bean id="echoBean" class="com.tridentforms.EchoBean"
singleton="true"/>