I'm writing an application that needs to produce at most 10000 messages for
every message consumed. This has to happen in a single transaction. If I
use a non transacted session, everything works fine (but doesn't meet the
requirements). If I set it to use a transacted session, the connection
hangs after a while with the following errors
3081 [main] DEBUG org.apache.activemq.ActiveMQSession - Sending message:
ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId =
ID:07166HOBDGXP-4713-1162482684322-1:0:1:1:109, originalDestination = null,
originalTransactionId = null, producerId =
ID:07166HOBDGXP-4713-1162482684322-1:0:1:1, destination = queue://AWTX.TEST,
transactionId = TX:ID:07166HOBDGXP-4713-1162482684322-1:0:1, expiration = 0,
timestamp = 1162482687730, arrival = 0, correlationId = null, replyTo =
null, persistent = true, type = null, priority = 4, groupID = null,
groupSequence = 0, targetConsumerId = null, compressed = false, userID =
null, content = [EMAIL PROTECTED],
marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true}
15001 [ActiveMQ Scheduler] DEBUG
org.apache.activemq.transport.InactivityMonitor - A send is in progress
29956 [ActiveMQ Scheduler] DEBUG
org.apache.activemq.transport.InactivityMonitor - A send is in progress
30003 [ActiveMQ Scheduler] DEBUG
org.apache.activemq.transport.InactivityMonitor - Message received since
last read check, resetting flag:
I've written a test prog to demo this
import java.io.Serializable;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
public class Main implements Serializable
{
static private Logger logger = Logger.getLogger(Main.class);
byte[] dummy = new byte[100000];
/**
* @param args
*/
public static void main(String[] args)
{
BasicConfigurator.configure();
try
{
ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory(
"tcp://localhost:61616");
Connection connection;
connection = factory.createConnection();
Session session = connection.createSession(true,
Session.SESSION_TRANSACTED);
MessageProducer producer =
session.createProducer(session.createQueue("AWTX.TEST"));
for (int i = 0; i < 1000; i++)
{
System.out.println(i);
ObjectMessage objectMessage =
session.createObjectMessage(new Main());
producer.send(objectMessage);
}
producer.close();
session.commit();
session.close();
connection.close();
}
catch (JMSException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
--
View this message in context:
http://www.nabble.com/Hanging-on-big-transacted-sessions-tf2560589.html#a7136242
Sent from the ActiveMQ - User mailing list archive at Nabble.com.