C# Websphere MQ 7.5.0.2在XA事务中接收消息时出现间歇性错误

C# Websphere MQ 7.5.0.2在XA事务中接收消息时出现间歇性错误,c#,.net,ibm-mq,distributed-transactions,C#,.net,Ibm Mq,Distributed Transactions,下面的示例程序应该定期启动,并且应该尽可能快地处理队列(另一台机器上)上的所有消息,然后停止。每个消息都应该在单独的分布式事务中处理,因为处理还需要访问和更改多个数据库 托管模式似乎太慢,因为它每3秒处理1条消息 非托管模式的性能可以接受,但我有两个问题 1) 程序结束时,服务器的事件日志包含数百条错误消息,所有消息都报告相同的错误: 28/01/2014 15:20:49 - Process(8604.48) User(<<username>>) Program(amq

下面的示例程序应该定期启动,并且应该尽可能快地处理队列(另一台机器上)上的所有消息,然后停止。每个消息都应该在单独的分布式事务中处理,因为处理还需要访问和更改多个数据库

托管模式似乎太慢,因为它每3秒处理1条消息

非托管模式的性能可以接受,但我有两个问题

1) 程序结束时,服务器的事件日志包含数百条错误消息,所有消息都报告相同的错误:

28/01/2014 15:20:49 - Process(8604.48) User(<<username>>) Program(amqrmppa.exe) Host(<<server machinename>>) Installation(Server) VRMF(7.5.0.2) QMgr(<<queuemanager name>>)

Error on receive from host <<client machinename>> (<<client ip>>).  

An error occurred receiving data from <<client machinename>> (<<client ip>>) over TCP/IP. This may be due to a communications failure.  

The return code from the TCP/IP recv() call was 10054 (X'2746'). Record these values and tell the systems administrator.

XA区域中几乎没有可用的修复程序。这些都是针对托管模式的。您可能希望联系IBM以获得这些修复并应用,看看这是否有帮助


谢谢。我们已经为XMS.NET的类似问题创建了PMR。我们将看到结果…我刚刚针对最近发布的v7.5 Fixpack 3测试了上面的程序。这包含了您提到的所有修复。非托管模式仍存在上述问题。托管模式似乎运行正常,但每次运行后,WMQ服务器的事件日志中仍会留下1个错误。
using System;
using System.Collections;
using System.Text;
using System.Transactions;
using IBM.WMQ;

namespace WMQTest
{
    internal class Program
    {
        private const string HostName = "TST010";
        private const int Port = 5021;
        private const string ChannelName = "CL_QMSTST010";
        private const string QueueManagerName = "QMSTST010";
        private const string QueueName = "SD.TRANSX.ARCHIVE";

        private static readonly MQGetMessageOptions GetMessageOptions = new MQGetMessageOptions
        {
            Options = MQC.MQGMO_WAIT + MQC.MQGMO_SYNCPOINT,
            WaitInterval = 20000
        };

        private static readonly TransactionOptions TransactionOptions = new TransactionOptions { Timeout = TransactionManager.DefaultTimeout, IsolationLevel = IsolationLevel.Serializable };

        private static void Main()
        {
            try
            {
                Console.WriteLine("Use managed mode?");
                var key = Console.ReadKey(true);
                bool managedMode = key.KeyChar == 'y' || key.KeyChar == 'Y';
                var properties = new Hashtable
                    {
                        {MQC.HOST_NAME_PROPERTY, HostName},
                        {MQC.PORT_PROPERTY, Port},
                        {MQC.CHANNEL_PROPERTY, ChannelName},
                        {
                            MQC.TRANSPORT_PROPERTY,
                            managedMode ? MQC.TRANSPORT_MQSERIES_MANAGED : MQC.TRANSPORT_MQSERIES_XACLIENT
                        }
                    };
                while (true)
                {
                    //starting a transaction scope            
                    using (var transaction = managedMode
                                                 ? new TransactionScope()
                                                 : new TransactionScope(TransactionScopeOption.Required,
                                                                        TransactionOptions,
                                                                        EnterpriseServicesInteropOption.Full))
                    {
                        using (var queueManager = new MQQueueManager(QueueManagerName, properties))
                        {
                            using (
                                MQQueue queue = queueManager.AccessQueue(QueueName,
                                                                         MQC.MQOO_INPUT_AS_Q_DEF +
                                                                         MQC.MQOO_FAIL_IF_QUIESCING))
                            {
                                var message = new MQMessage();
                                try
                                {
                                    queue.Get(message, GetMessageOptions);
                                }
                                catch (MQException ex)
                                {
                                    if (ex.CompCode != 2 || ex.ReasonCode != MQC.MQRC_NO_MSG_AVAILABLE)
                                    {
                                        throw;
                                    }
                                    //No message available, stop
                                    break;
                                }
                                //TODO: DO SOME INTERESTING DATABASE STUFF HERE
                                Console.WriteLine(Encoding.ASCII.GetString(message.MessageId));
                                //
                                message.ClearMessage();
                                queue.Close();
                            }
                            queueManager.Disconnect();
                        }
                        transaction.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION OCCURRED");
                Console.WriteLine("==================");
                Console.WriteLine(ex);
            }
        }
    }
}