Topic
No replies
SystemAdmin
SystemAdmin
8523 Posts
ACCEPTED ANSWER

Pinned topic XMS receive message from an empty queue results in pending DTC transactions

‏2013-01-19T23:46:05Z |
Hello

I am getting pending transactions in DTC console. The transactions are all in "only failed to notify" state and occur when a consumer attempts to receive a message from en empty queue. Below is a short code that should hopefully demonstrate this. It all seem to be fine if there are messages on the queue (all transactions will complete). Using Win64, MQ Client 7.1.0.2, XMS.
Would somebody be able help with this?

Thanks
public void PendingTransactions()
{
var factory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
var cf = factory.CreateConnectionFactory();
cf.SetStringProperty(XMSC.WMQ_HOST_NAME, TestTargets.InputQueue.Host.HostName);
cf.SetIntProperty(XMSC.WMQ_PORT, TestTargets.InputQueue.Host.Port);
cf.SetStringProperty(XMSC.WMQ_CHANNEL, TestTargets.InputQueue.Host.Channel);
cf.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
cf.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, TestTargets.InputQueue.Host.Manager);

var connection = cf.CreateConnection();
var session = connection.CreateSession(true, AcknowledgeMode.SessionTransacted);
var queue = session.CreateQueue(TestTargets.InputQueue.Queue);
queue.SetIntProperty(XMSC.DELIVERY_MODE, XMSC.DELIVERY_PERSISTENT);
var consumer = session.CreateConsumer(queue);
connection.Start();

using (var scope = new TransactionScope(TransactionScopeOption.Required))
{
consumer.Receive(1);
scope.Complete();
}
using (var scope = new TransactionScope(TransactionScopeOption.Required))
{
consumer.Receive(1);
scope.Complete();
}
}