On GlassFish Server 2.1 I have created a GenericJMSRA for connection with ActiveMQ as described in this guideline: http://activemq.apache.org/sjsas-with-genericjmsra.html
I have successfully been able to deploy an MDB using the the classical way of injecting the context with ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>QueueListener</ejb-name>
<ejb-class>foo.QueueListenerMDB</ejb-class>
<transaction-type>Container</transaction-type>
</message-driven>
</enterprise-beans>
</ejb-jar>
and sun-ejb-jar.xml
<?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/appserver/dtds/sun-ejb-jar_2_1-1.dtd'>
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>QueueListener</ejb-name>
<mdb-connection-factory>
<jndi-name>jms/amqQueueConnectionFactory</jndi-name>
</mdb-connection-factory>
<mdb-resource-adapter>
<resource-adapter-mid>activemqra</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>destination</activation-config-property-name>
<activation-config-property-value>qRequest</activation-config-property-value>
</activation-config-property>
</activation-config>
</mdb-resource-adapter>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
How would I go ahead injecting the above configuration in annotation driven EJB 3.0 style? More specifically it is the following property I can't find out how to inject:
<resource-adapter-mid>activemqra</resource-adapter-mid>
Got it to work finally.
I removed ejb-jar.xml completely and left the sun-ejb-jar.xml untouched. Then I annotated the class foo.QueueListenerMDB as follows:
@MessageDriven(name = "QueueListener", mappedName = "QueueListener")
public class QueueListenerMDB implements MessageListener {
...
}