Not entirely sure what you are trying to accomplish here. You always
commit the messages so they are going to get sent, and if you use the
default redelivery policy the messages that a consumer receives but
rolls back will get redelivered.
On 07/05/2013 03:53 AM, cineva wrote:
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.
--
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.b...@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/
www.camelone.org : The open source integration conference: