<connector-connection-pool associate-with-thread="false" connection-creation-retry-attempts="0"
connection-creation-retry-interval-in-seconds="10" connection-definition-name="javax.jms.ConnectionFactory"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" fail-all-connections="false"
idle-timeout-in-seconds="300" is-connection-validation-required="false" lazy-connection-association="false"
lazy-connection-enlistment="false" match-connections="true" max-connection-usage-count="0" max-pool-size="32"
max-wait-time-in-millis="60000" name="jms/SpoolerTopicFactoryPool" pool-resize-quantity="2" resource-adapter-name="jmsra"
steady-pool-size="8" validate-atmost-once-period-in-seconds="0">
<description>Spooler Events Connection Factory Pool</description>
</connector-connection-pool>
<admin-object-resource enabled="true" jndi-name="jms/SpoolerTopic" object-type="user" res-adapter="jmsra" res-type="javax.jms.Topic">
<description>This is the Spoolers' event queue</description>
<property name="Name" value="spoolerEvents"/>
</admin-object-resource>
In Glassfish this was enough to have the application server to automatically deploy the required resources to the server, and then inject them into the Spooler class when needed.
I've tried a number of approaches to get the same behaviour on JBoss, unfortunately with no luck.
I've read the instructions outlined here:
http://community.jboss.org/wiki/HowtouseanapplicationclientinJBoss-5 but they do not seem to cater for my needs. (ie. They detail how to inject an ALREADY EXISTING queue from the global JNDI, using the 'mappedName' approach. They also detail how to inject a resource into a application client - this seems similar, but I'm trying to inject into an EJB3)
The closest I have got is that I have created the following deployment descriptors:
jboss-connection-factories-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<connection-factories>
<no-tx-connection-factory>
<jndi-name>SpoolerConnectionFactory</jndi-name>
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/defaultJMSProvider</config-property>
</no-tx-connection-factory>
</connection-factories>
jboss-destinations-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.jms.server.destination.TopicService"
name="jboss.messaging.destination:service=Topic,name=SpoolerTopic"
xmbean-dd="xmdesc/Topic-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
</mbean>
</server>
These seem to deploy the resources I would like to use, however I'm still struggling with injecting these into the application. I've tried using these deployment descriptors with the information found on the Apache ActiveMQ web site in conjuction, as follows:
ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
version = "3.0"
<enterprise-beans>
<session>
<ejb-name>Spooler</ejb-name>
<ejb-class>com.photobox.Spooler</ejb-class>
<resource-ref>
<res-ref-name>jms/SpoolerTopicFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>jms/SpoolerTopic</message-destination-ref-name>
<message-destination-type>javax.jms.Topic</message-destination-type>
<message-destination-link>SpoolerTopic</message-destination-link>
</message-destination-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<message-destination>
<message-destination-name>SpoolerTopic</message-destination-name>
</message-destination>
</assembly-descriptor>
</ejb-jar>