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?