Index > Using ActiveMQ with EJB3 (JBoss Example)
I've seen numerous postings regarding ActiveMQ with EJB3, and variations of a datasource XML file for use with JBoss integration.
However, they don't quite work. Here is what worked for me, it is actually quite simple:
Here is a working example - for EJB3 on JBoss, no XML descriptors are needed, just the RA file and the MDB.
import org.jboss.annotation.ejb.ResourceAdapter;
@MessageDriven(activationConfig = {  
   @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),  
   @ActivationConfigProperty(propertyName="destination", propertyValue="FOO.TEST"),  
   @ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge")  
})  
@ResourceAdapter("activemq-rar-4.1.1.rar")  
public class TestBean implements MessageListener {
   public TestBean() {  
   }
   public void onMessage(Message message) {  
   }
}