1

In Jboss 5.x, JMS model- queue (Point to point) used to be implemented as follows (MDB class and ejb-jar.xml)

MDB

package receiver;
import javax.jms.JMSException;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import javax.jms.Message;
public class WildFlyJmsQueueReceiveLocal  implements MessageListener {
public void onMessage(Message msg) {
 try {
     System.out.println("[WildFlyJmsQueueReceiveLocal][onMessage]There are three kinds of basic JMS connection-factory that depends on the type of connectors that is used.");          
   String msgText;
       if (msg instanceof TextMessage) {
          msgText = ((TextMessage)msg).getText();
       } else {
          msgText = msg.toString();
       }
       if (msgText.equalsIgnoreCase("quit")) {
         synchronized(this) {
             this.notifyAll(); // Notify main thread to quit
         }
       }           
  } catch (JMSException | InterruptedException jmse) {
      jmse.printStackTrace();
 }
}
}

ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
<display-name>MDB</display-name>
<enterprise-beans>
<message-driven>
 <display-name>MDB1</display-name>
 <ejb-name>MDB1</ejb-name>
 <ejb-class>receiver.WildFlyJmsQueueReceiveLocal</ejb-class>
 <transaction-type>Container</transaction-type>
 <activation-config>
    <activation-config-property>
        <activation-config-property-name>destinationType</activation-config-property-name>
        <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
        <activation-config-property-name>destination</activation-config-property-name>
        <activation-config-property-value>jms/queue/TestQ</activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
    <activation-config-property-name>maxSession</activation-config-property-name>
   <activation-config-property-value>2</activation-config-property-value>
    </activation-config-property>
</activation-config>
</message-driven>
</enterprise-beans>
</ejb-jar>

Now i am migrating from jboss 5.x to wildfly10. In wildfly 10, JMS feature has been implemented using 'Apache ActiveMQ Artemis'. So In wildfly 10, first i configured queue 'jms/queue/TestQ' and tried to deploy same code (which was used in jboss 5.x), It was running successfully. I thought i have to create 'ActiveMQConnectionFactory' object and do the further stuff, but it was not like that. The JMS API which i had used in Jboss 5.x,was working fine in wildfly10.

JMS sender and receiver is deployed on same wildfly instance. Am i implementing correctly the JMS queue feature? Is it the right way to do in wildfly10. If not please direct me to the link/documentation.

My Que is Java code which i had used in Jboss 5.x (for JMS-Queue implementation) will work in Wildfly-10 without any change?

Kamal Vijay
  • 47
  • 1
  • 13
  • Please reply... – Kamal Vijay May 25 '17 at 07:06
  • The same code will work. How you are sending the message? When your sender send the message, is it get added in queue? You can check it on `admin-console`. Check weather count for `Messages Added` is increased or not for your queue. If not then issue with your sender. – Hitesh Ghuge Sep 23 '17 at 04:38

1 Answers1

1

For Jboss 5.x go to JMS links :

https://docs.jboss.org/jbossas/guides/j2eeguide/r2/en/html/ch6.chapt.html

user595014
  • 114
  • 3
  • 8
  • 20
  • Thankx for reply, I have already implemented JMS feature in Jbooss 5.x. The code which i had used in Jboss 5.x, is also working in wildfly-10. . Am i implementing correctly the JMS queue feature in wildfly-10? Is it the right way to do in wildfly10. If not please direct me to the link/documentation. – Kamal Vijay May 22 '17 at 05:40
  • @Kamal Vijay... Actually i have not worked on wildfly-10. Wildfly-10 expert can guide you for JMS implementation. – user595014 May 23 '17 at 04:23