If an MDB causes a JMS message to be sent during the call to onMessage(), ActiveMQ won't close its connection. I'm using JMS2 through an @Inject'ed JMSContext. My sample project is an EAR with an EJB JAR (containing a service and an MDB) and a JAX-RS endpoint (entry point for the test).
1) Build the EAR
2) Run wildfly with the standalone-full.xml configuration:
3) Enable debug and error reporting for leaked connections with ActiveMQ/CCM:
4) Deploy the EAR.
5) Access http://localhost:8080/leak-web/rest/test?message=Hi
The REST endpoint will send a message to the test topic (Defined in leak-ejb/src/main/java/test/mdb/TestTopic.java). TestTopicListener (in the same package as TestTopic) will receive the message and send a second message to the topic. Upon returning from TestTopicListener.onMessage(), the message is sent, but this shows up in the logs
(see attached log.txt)
I have no idea why JIRA attached each file twice.