Update 11.7.2013:
New version for JBoss 7.2.0.Alpha1 / EAP 6.1.0.Alpha1 can be found here: http://blog.coffeebeans.at/?p=606
———————–
JBoss 7 and ActiveMQ finally work together.
- Download the latest snapshot of activemq.rar.
- Unzip the file and name the resulting folder activemq.rar.
- Place the folder in you deployments folder of jboss.
- Place the files ra.xml and ironjacamar.xml into the META-INF subfolder of the activemq.rar folder. Overwrite the existing ra.xml file.
- Change both files as needed. Queues and topics are configured in ironjacamar.xml.
- Create an empty file activemq.rar.dodeploy.
That’s it. Now you should be able to create a MDB that connects to a remote ActiveMQ server. Here an example to the configuration above:
import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.inject.Inject; import javax.jms.Message; import javax.jms.MessageListener; import org.jboss.ejb3.annotation.ResourceAdapter; import org.jboss.logging.Logger; /** * @author manuel * */ @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "activemq/queue/TestQueue") }) @ResourceAdapter("activemq.rar") public class RemoteActiveMQConsumer implements MessageListener { @Inject private Logger log; @Override public void onMessage(Message msg) { log.debugf("received message: %s", msg); } }
UPDATE: 29.4.2013 (thanks to Bruno Valentim)
To get activemq running with JBoss 7.1.1 the following steps are required:
1) Instead of the mentioned snapshot use http://repo1.maven.org/maven2/org/apache/activemq/activemq-rar/5.7.0/activemq-rar-5.7.0.rar
2) under subsystem xmlns=”urn:jboss:domain:ejb3:1.2″ in standalone.xml add:
<mdb> <resource-adapter-ref resource-adapter-name=”activemq.rar”/> <bean-instance-pool-ref pool-name=”mdb-strict-max-pool”/> </mdb>
Notice: a “A node is already registered at ‘(deployment => activemq-ra.rar)” exception could remain but it should work anyway.