activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cineva <andreigheorghe...@yahoo.com>
Subject ActiveMQ-CPP - Rollback function returns but the server isn't done rollbacking
Date Fri, 05 Jul 2013 07:53:41 GMT
The following program depends on the time it takes to rollback the session.
If I run it in a debugger line by line it returns the correct behavior
("Another Test message" in "testqueue" queue) but if I let it run I get
"Test message". Is this something by design (are only asynchronous rollbacks
supported?) or is it a bug? This test program will always return "Another
Test message" if I increase to time to receive the message because it has
time to get the message because the rollback is finished but it doesn't
solve the issue. I don't know if this is a server or client issue.

	ActiveMQConnectionFactory factory("tcp://localhost:61616");
	cms::Connection* connection(factory.createConnection());
	connection->start();

	cms::Session* session =
connection->createSession(cms::Session::SESSION_TRANSACTED);
	cms::Queue* queue = session->createQueue("testqueue");
	cms::MessageProducer* producer(session->createProducer(queue));
	cms::MessageConsumer* consumer = session->createConsumer(queue);

	cms::Message* message = session->createTextMessage("Test message");
	producer->send(message);

	session->commit();

	for ( int i=1; i<=4; i++ )
	{
		cms::Message* receivedMessage = consumer->receive(500);
		if ( receivedMessage && receivedMessage->getIntProperty(
"JMSXDeliveryCount" ) == 3 )
		{
			cms::Message* newMessage = session->createTextMessage("Another Test
message");
			producer->send(newMessage);
			session->commit();
		}
		else
			session->rollback();
	}



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-CPP-Rollback-function-returns-but-the-server-isn-t-done-rollbacking-tp4668896.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message