activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From damNda <>
Subject ActiveMQ integration in jboss
Date Thu, 29 Mar 2012 12:37:44 GMT
Hello everyone ,
I want to use activeMQ in jboss global transaction.
In fact, I will  have  a project with an oracle datasource and ActiveMQ.
What I want to do is combining in the same trasaction database update and
messages sending.
To do that , I followed the instructions here :

To test it , i made this EJB for message sending :

package com.dams.test;

import javax.annotation.Resource;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.transaction.RollbackException;

import org.jboss.annotation.ejb.RemoteBinding;

@RemoteBinding(jndiBinding = MessageSenderInterface.JNDI_NAME)
public class MessageSender implements MessageSenderInterface{
	private ConnectionFactory queueConnectionFactory;
	final String queue ="queue/testDams";
	public void sendMessage(String message,boolean throwError) throws Exception

		Connection connection =queueConnectionFactory.createConnection();
		Session session =connection.createSession(Boolean.TRUE,
		Destination dest=session.createQueue(queue);
		MessageProducer producer=session.createProducer(dest);
		Message messages=session.createTextMessage(message);
		if(throwError) throw new RollbackException("Exceptiooooooooooooooooooon");	

The problem is the message is send by the resource adapter even if tthe
rollBack exception is throw.

Help please.


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message