MDB Not consuming mesages from MQ Queue
laxmanporeddy Apr 7, 2015 9:20 PMI have written Message Driven Bean program( created jar) and deployed into JBOSS 6 to retrieve message from MQ Queue
Here is mdb Code
@MessageDriven(
activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "providerAdapterJNDI", propertyValue = "java:jboss/jms/WMQCF"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "java:jboss/jms/testQueue"),
@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true")
})
public class WebsphereMQMessageDrivenBean implements MessageListener {
TextMessage txtMsg = (TextMessage)message;
String msg =null;
try {
msg = txtMsg.getText();
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("MDB Recevied Text Msg: "+msg);
}
standalone-full.xml file:
-------------------------------------
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.1">
<resource-adapters>
<resource-adapter id="wmq.jmsra.rar">
<archive>
wmq.jmsra.rar
</archive>
<transaction-support>XATransaction</transaction-support>
<connection-definitions>
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/jms/WMQCF" use-java-context="true" pool-name="WMQCF">
<config-property name="port">
1414
</config-property>
<config-property name="channel">
CLIENT_JBOSS
</config-property>
<config-property name="hostName">
MQ HOST
</config-property>
<config-property name="transportType">
CLIENT
</config-property>
<config-property name="queueManager">
HERE QM
</config-property>
<xa-pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>10</max-pool-size>
</xa-pool>
<security>
<application/>
</security>
<timeout>
<allocation-retry>3</allocation-retry>
<allocation-retry-wait-millis>5000</allocation-retry-wait-millis>
</timeout>
<recovery no-recovery="true"/>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/jms/testQueue" use-java-context="true" pool-name="testQueue">
<config-property name="baseQueueManagerName">
HERE QM
</config-property>
<config-property name="baseQueueName">
TEST.JBOSS6
</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
</resource-adapters>
</subsystem>
Below is the Jboss 6 server log when I deploy MDB into server.
-------------------------------------------------------------------
21:12:15,780 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "FirstMQProject.jar" (runtime-name: "FirstMQProject.jar")
21:12:15,838 INFO [org.jboss.as.ejb3] (MSC service thread 1-6) JBAS014142: Started message driven bean 'WebsphereMQMessageDrivenBean' with 'hornetq-ra' resource adapter
21:12:16,076 INFO [org.jboss.as.server] (HttpManagementService-threads - 3) JBAS018559: Deployed "FirstMQProject.jar" (runtime-name : "FirstMQProject.jar")
I do not see any errors in logs and deployed application successfully.
Finally I put the message in MQ queue but MDB is not consuming message. (message still in queue) - and also no error in logs
Not sure where did i mistake .please help me.