while working on the CTS with EAP 5.1 and HornetQ, I encounter the issue https://jira.jboss.org/browse/HORNETQ-339
When the AS is stopped, HornetQ server is stopped first
=> the RA connections will detect that the server is down and will try to reconnect indefinitely (as they're using in-vm)
=> the server will be blocked by this infinite loop and will never shutdown
We need to make sure to stop the resource adapter *before* stopping HornetQ server.
Starting from the fix provided by Maurice (http://community.jboss.org/message/534116), I have added a HornetQRAService POJO.
This class has a single stop() method which stops the resource adapter (using the injected mbean server to access the RA through JMX).
In AS6 hornetq-jboss-beans.xml, I added a bean declaration:
<bean name="HornetQRAService" class="org.hornetq.ra.HornetQRAService"> <constructor> <parameter> <inject bean="MBeanServer"/> </parameter> </constructor> <depends>HornetQServer</depends> </bean>
This will make sure that HornetQRAService.stop() will be called before HornetQServer.stop() to preserve the correct shutdown sequence.
It's a bit of a hack but I've not found a cleaner/simpler way to order HornetQ server and RA shutdown sequence.
wdyt?
There is currently an issue where an MDB is started before the hornetq server has deployed its queues, maybe this is just a dependency ordering thing and they are linked?