1

WebSphere Queue アトミックを更新しようとしていますが、次の問題が発生しています。これは、メソッド呼び出しを using (CommittableTransaction) ブロック内にラップしたために発生します。ブロックの外でメソッド呼び出しを行うと、正常に動作します。これは単に C# 内の Queue への書き込みの制限ですか?

 using (CommittableTransaction transScope = new CommittableTransaction())
 {
      CommittableTransaction.Current = transScope;


      try
      {                        

          foreach (string agentItem in qSqlContents.Values)
          {
                // Define a WebSphere MQ message, writing some text in UTF format
                MQMessage mqMessage = new MQMessage();
                mqMessage.Write(StrToByteArray(agentItem));

                // Specify the message options
                MQPutMessageOptions pmo = new MQPutMessageOptions();

                // MQC.MQPMO_SYNCPOINT = provide transaction support for the Put.
                pmo.Options = MQC.MQPMO_SYNCPOINT;

                // Put the message on the queue
                _outputQueue.Put(mqMessage, pmo);
          }                       
       }
       catch (Exception)
       {
          transScope.Rollback();                        
       }
       finally
       {
          transScope.Commit();                        
       }
 }

ここで要求されているように、完全な例外情報は次のとおりです。

MQRC_FUNCTION_NOT_SUPPORTED
Exception | System.Exception
     base {object} | object 
Non-Public members | 
     _COMPlusExceptionCode = -532459699
4

1 に答える 1

0

これを試してみてください。一般的に物事をスピードアップするいくつかの調整があります。これで問題が解決するかどうかは100%確実ではありませんが、診断に役立つ可能性があります...

// Specify the message options
MQPutMessageOptions pmo = new MQPutMessageOptions();

// MQC.MQPMO_SYNCPOINT = provide transaction support for the Put.
pmo.Options = MQC.MQPMO_SYNCPOINT;
CommittableTransaction transScope = new CommittableTransaction();
CommittableTransaction.Current = transScope;    

try
{                            
    foreach (string agentItem in qSqlContents.Values)
    {
        // Define a WebSphere MQ message, writing some text in UTF format
        MQMessage mqMessage = new MQMessage();
        mqMessage.Write(StrToByteArray(agentItem));

        // Put the message on the queue
        _outputQueue.Put(mqMessage, pmo);
    }                       
}
catch (Exception)
{
    transScope.Rollback();                        
}
finally
{
    _outputQueue.close();
    transScope.Commit(); 
    transScope.Dispose();                       
}
于 2012-08-14T20:36:37.707 に答える