try
{
using (var scope = new TransactionScope())
{
using (var connection = connectionFactory.CreateConnection())
{
connection.Start();
using (var session = connection.CreateSession(true, AcknowledgeMode.SessionTransacted))
{
using (var queue = session.CreateQueue(queueName))
{
using (var consumer = session.CreateConsumer(queue))
{
var message = consumer.Receive();
}
}
}
}
throw new Exception();
}
}
catch (Exception)
{
}
It will commit recieving (acknowledge) of the message despite of exception. Why? If I comment line "using (var scope = new TransactionScope())" then the message will remain in the queue.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum