I'm having difficulty configuring JB EAP7 to use RabbitMQ as a message broker. I have created a rabbitmq module and defined it as a global module in my standalone-ha.xml.
modules/system/layers/base/com/rabbitmq/main/module.xml:
<module xmlns="urn:jboss:module:1.1" name="com.rabbitmq">
<resources>
<resource-root path="rabbitmq-jms-1.7.0.jar"/>
<resource-root path="amqp-client-4.2.0.jar" />
</resources>
<dependencies>
<module name="javax.api" />
<module name="javax.transaction.api"/>
<module name="org.slf4j"/>
</dependencies>
</module>
JB7 starts without issues. But I see the following in my server.log, showing that the MDB is trying to bind to an ActiveMQ connection (the default provider in Wildfly I guess):
2017-08-29 17:24:09,193 INFO [org.jboss.as.ejb3]WFLYEJB0042: Started message driven bean 'Subscriber' with 'activemq-ra' resource adapter
2017-08-29 17:24:09,368 INFO [javax.enterprise.resource.webcontainer.jsf.config]Initializing Mojarra 2.2.12-jbossorg-2 for context '/webapp-0.0.1-SNAPSHOT'
2017-08-29 17:24:09,462 INFO [org.apache.activemq.artemis.ra]AMQ151000: awaiting topic/queue creation java:/global/mq/kodo
2017-08-29 17:24:10,103 INFO [org.wildfly.extension.undertow]WFLYUT0021: Registered web context: /webapp-0.0.1-SNAPSHOT
2017-08-29 17:24:10,285 INFO [org.jboss.as.server]WFLYSRV0010: Deployed "webapp-0.0.1-SNAPSHOT.war" (runtime-name : "webapp-0.0.1-SNAPSHOT.war")
2017-08-29 17:24:10,286 INFO [org.jboss.as.server]WFLYSRV0010: Deployed "kodo-jdo.rar" (runtime-name : "kodo-jdo.rar")
2017-08-29 17:24:11,465 INFO [org.apache.activemq.artemis.ra]AMQ151001: Attempting to reconnect org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.apache.activemq.artemis.ra.ActiveMQResourceAdapter@78712571 destination=java:/global/mq/kodo destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)
I'm not sure how to identify in my MDB that I want the MDB to use my RabbitMQ defined ConnectionFactory. My MDB is defined as:
@MessageDriven(
activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "java:/global/mq/kodo") })
public class Subscriber implements MessageListener {
public void onMessage(final Message message) {
try {
System.out.println(message.getBody(Object.class).toString());
} catch (JMSException e) {
// TODO Auto-generated catch block
throw new RuntimeException(e);
}
}
}
but I cannot find documentation where/how to specify the ConnectionFactory. I've tried adding a @JMSConnectionFactory( String JNDI)
annotation to my class and I'm still getting the same result.
Am I missing something in my RabbitMQ module definition? Is my MDB not annotated correctly? What do I need to do in order to configure my MDB to use my RabbitMQ ConnectionFactory to connect to the Message Broker?