2 Replies Latest reply on Dec 10, 2015 1:56 PM by John Sanda

    Is there a way to use message listeners and message driven beans together?

    John Sanda Apprentice

      I have a set of applications primarily deployed as WARs in which MDBs and JMS message listeners are used. MDBs are primarily used, but there is one scenario in which we dynamically start/stop consuming messages. In this scenario we use message listeners, i.e., call JMSConsumer.setMessageListener(). The project is currently running on WildFly 9 and is using ActiveMQ 5.10 instead of WildFly's messaging subsystem. We are in the process of migrating to WildFly 10 and switching over to using the default messaging subsystem which I know is implemented on top of ActiveMQ Artemis. I have been able to get message listeners working by commenting out the pooled-connection-factory(s) in my server's messaging-activemq subsystem configuration. When I started testing MDBs the deployments were failing. I realized that this is due to not having any pooled connection factories defined. Declaring the pooled connection factories makes my MDBs deploy, but I am no longer able to use message listeners. I get exceptions like,

       

      javax.jms.IllegalStateRuntimeException: This method is not applicable inside the application server. See the J2EE spec, e.g. J2EE1.4 Section 6.6
        at org.apache.activemq.artemis.ra.ActiveMQRASession.checkStrict(ActiveMQRASession.java:1452)
        at org.apache.activemq.artemis.ra.ActiveMQRAMessageConsumer.setMessageListener(ActiveMQRAMessageConsumer.java:123)
        at org.apache.activemq.artemis.jms.client.ActiveMQJMSConsumer.setMessageListener(ActiveMQJMSConsumer.java:59)
      

       

      Are there any server configuration changes or settings in Artemis I can apply in order to use both message listeners and MDBs?