How to specify which ConnectionFactory to use with RabbitMQ-JMS in an MDB (using Wildfly)

1,162 views
Skip to first unread message

Eric B

unread,
Aug 29, 2017, 3:51:16 PM8/29/17
to rabbitmq-users
I'm trying to understand how to configure RabbitMQ-JMS in Widlfly10.

I've read through the docs 5 times, but I'm stuck at a critical point - I'm not sure how to define the connection factory when creating a destination.

In my standalone-ha.xml file, I have:

        <subsystem xmlns="urn:jboss:domain:naming:2.0">
           
<bindings>
               
<object-factory name="java:global/mq/kodo" module="com.rabbitmq" class="com.rabbitmq.jms.admin.RMQObjectFactory">
                   
<environment>
                       
<property name="className" value="javax.jms.Queue"/>
                       
<property name="amqp" value="true"/>
                       
<property name="amqpExchangeName" value="kodo"/>
                       
<property name="amqpRoutingKey" value="kodo"/>
                       
<property name="amqpQueueName" value="kodo"/>
                       
<property name="destinationName" value="kodo"/>
                   
</environment>
               
</object-factory>
               
<object-factory name="java:global/jms/rabbitMQ/ConnectionFactory" module="com.rabbitmq" class="com.rabbitmq.jms.admin.RMQObjectFactory">
                   
<environment>
                       
<property name="className" value="javax.jms.ConnectionFactory"/>
                       
<property name="username" value="test"/>
                       
<property name="password" value="test"/>
                       
<property name="virtualHost" value="/"/>
                       
<property name="host" value="localhost"/>
                   
</environment>
               
</object-factory>
           
</bindings>
           
<remote-naming/>
       
</subsystem>


But the problem is that there is no "link" between my Queue and my ConnectionFactory.  How do I specify to me MDB to use the "global/jms/rabbitMQ/ConnectionFactory" when trying to access my kodo queue?

My MDB is very simple:
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;

@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 when I start Wildfly, I see the following my by server.log

server.log:
2017-08-29 15:28:18,924 ERROR [org.jboss.msc.service.fail]MSC000001: Failed to start service jboss.deployment.unit."webapp-0.0.1-SNAPSHOT.war".component.Subscriber.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.unit."webapp-0.0.1-SNAPSHOT.war".component.Subscriber.CREATE: Failed to start service
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: WFLYEJB0383: No message listener of type javax.jms.MessageListener found in resource adapter activemq-ra
        at org.jboss.as.ejb3.component.EJBUtilities.createActivationSpecs(EJBUtilities.java:102)
        at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:103)
        at org.jboss.as.ee.component.BasicComponentCreateService.start(BasicComponentCreateService.java:90)
        at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.start(MessageDrivenComponentCreateService.java:85)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
        ... 3 more



So my MDB is clearly still searching for something in activemq.  That would imply to me that the MDB is still not using my Rabbit ConnectionFactory, but instead is trying to use an activemq connection.

I'm assuming that I have missed a configuration step somewhere, but not entirely sure where.   My standalone-ha.xml currenly has the default activemq configuration as found in the standalone-ha-full.xml.

Have I missed a step somewhere?  Where/how do I have to set the configuration?

Thanks,

Eric

Luke Bakken

unread,
Aug 29, 2017, 9:52:29 PM8/29/17
to rabbitmq-users
Hi Eric,

This falls into the category of "yolo googling" but seems like it may be the same issue you're seeing, if only because the phrase "found in resource adapter activemq-ra" matched -


Good luck!
Luke

Eric B

unread,
Aug 29, 2017, 11:50:27 PM8/29/17
to rabbitm...@googlegroups.com
Hi Luke,

Thanks, but I'm still quite lost.  Do I need a jca adapter for RabbitMQ and Wildfly?  Does one exist?  Where/how do I configure such a thing?

Is RabbitMQ not supported for Wildfly?  I would never have expected using a Broker with a JMS interface to be so complex to set up.  It took me about 15mins with Spring, and yet, I've already burnt the better part of a day failing at getting it to work with Wildfly.

Thanks,

Eric

--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/wEQLoX7sXFg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arnaud Cogoluègnes

unread,
Aug 30, 2017, 4:26:00 AM8/30/17
to rabbitm...@googlegroups.com
I don't think you need a JCA adapter. Someone contributed support for Wildfly in JMS client 1.7.0, so I guess it's possible to make it work.  


To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.

Eric B

unread,
Aug 31, 2017, 4:22:23 PM8/31/17
to rabbitm...@googlegroups.com
Any idea who might have made that contribution and/or how to reach them?  Do you know if there are commits or PRs in github that might point to the author? 

Thanks

Eric

Michael Klishin

unread,
Aug 31, 2017, 4:24:30 PM8/31/17
to rabbitm...@googlegroups.com
All RabbitMQ development happens on GitHub under the rabbitmq org (this does not include
most of client libraries which are community developed and maintained).

Searching for "Wildfly" in JMS client PRs:

--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Eric B

unread,
Aug 31, 2017, 5:37:18 PM8/31/17
to rabbitm...@googlegroups.com
Thanks Michael,

I had found that and dug through the reflog to get an email address to contact the contributor.

Thanks,

Eric


MK

Staff Software Engineer, Pivotal/RabbitMQ

--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/wEQLoX7sXFg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-users+unsubscribe@googlegroups.com.

Arnaud Cogoluègnes

unread,
Sep 1, 2017, 4:15:19 AM9/1/17
to rabbitm...@googlegroups.com
And searching for "wildfly" in the mailing list reveals:

Rémi Bantos

unread,
Sep 5, 2017, 8:11:33 AM9/5/17
to rabbitmq-users
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/wEQLoX7sXFg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.

To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages