-
1. Re: JBossMQ, JMS Message in transaction?
stephanenicoll Jul 11, 2004 6:22 AM (in response to iamapony)Show the code that sends the message to QueueA in your session bean.
It should NOT use JMS transacted session (i.e. pass true when you create your JMS session). If your Session Bean is enlisted to a JTA transaction, sending of the JMS message will also be enlisted automatically.
Regards,
Stephane -
2. Re: JBossMQ, JMS Message in transaction?
iamapony Jul 12, 2004 11:23 AM (in response to iamapony)That's what I thought as well, but it doesn't appear to be happening.. Here's the code.
QueueSender sender = null;
QueueSession session = null;
QueueConnection conn = null;
try {
InitialContext iniCtx = new InitialContext();
Object tmp = iniCtx.lookup("RMIXAConnectionFactory");
QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
conn = qcf.createQueueConnection();
Queue queA = (Queue) iniCtx.lookup("queue/A");
session = conn.createQueueSession(false,
QueueSession.AUTO_ACKNOWLEDGE);
conn.start();
sender = session.createSender(queA);
ObjectMessage om = session.createObjectMessage(message);
sender.send(om);
} catch (NamingException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
// Ensure that the Connection always gets closed
try {
if (sender != null) {
sender.close();
sender = null;
}
if (session != null) {
session.close();
session = null;
}
if (conn != null) {
conn.close();
conn = null;
}
} catch (JMSException je) {
je.printStackTrace();
}
} -
3. Re: JBossMQ, JMS Message in transaction?
iamapony Jul 12, 2004 7:28 PM (in response to iamapony)Found the answer, you have to use the java:/JmsXA JMS Provider Resource... More information and sample code in link below.
http://www.jboss.org/wiki/Wiki.jsp?page=JmsSenderBean