JMS in JBoss AS 6.0.0.M3
frank.cornelis May 11, 2010 7:37 AMSince the JMS provider changed in JBoss AS 6.0.0.M3 to HornetQ, my messages no longer are delivered to the MDB when using an XA MySQL DefaultDS datasource. Everything works as expected when using the embedded HSQLDB. The JMS did work on JBoss AS 6.0.0.M2 when using a (local-tx) MySQL datasource. What should be configured to make the HornetQ JMS provider to work with an XA MySQL datasource?
I send to the JMS queue via the regular code as follows:
QueueConnection queueConnection = this.queueConnectionFactory
.createQueueConnection();
try {
QueueSession queueSession = queueConnection.createQueueSession(
true, Session.AUTO_ACKNOWLEDGE);
try {
HarvestMessage harvestMessage = new HarvestMessage(issuerName,
false);
QueueSender queueSender = queueSession.createSender(this.queue);
try {
queueSender
.send(harvestMessage.getJMSMessage(queueSession));
} finally {
queueSender.close();
}
} finally {
queueSession.close();
}
} finally {
queueConnection.close();
}
Where queueConnectionFactory is defined as:
@Resource(mappedName = "java:JmsXA")
private QueueConnectionFactory queueConnectionFactory;
And the queue as:
@Resource(mappedName = HarvesterMDB.HARVESTER_QUEUE_NAME)
private Queue queue;
The MDB has the following annotations:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = HarvesterMDB.HARVESTER_QUEUE_NAME) })
With the queue name:
public static final String HARVESTER_QUEUE_NAME = "queue/trust/harvester";
Further I have a hornetq-jms.xml in my SAR META-INF directory containing:
<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
<queue name="TrustServiceHarvester">
<entry name="/queue/trust/harvester" />
</queue>
</configuration>
This configuration works with the default HSQLDB datasource, but when switching to the XA MySQL datasource (see below for the config) the messages are no longer delivered.
<datasources>
<xa-datasource>
<jndi-name>DefaultDS</jndi-name>
<track-connection-by-tx>true</track-connection-by-tx>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
<xa-datasource-property name="ServerName">localhost</xa-datasource-property>
<xa-datasource-property name="DatabaseName">trust</xa-datasource-property>
<xa-datasource-property name="User">trust</xa-datasource-property>
<xa-datasource-property name="Password">some-password</xa-datasource-property><metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</xa-datasource>
</datasources>