.NETのMSMQバックエンド

.NET エージェント(エージェント)は、インストゥルメント化された階層が MSMQ へのコールを実行すると、MSMQ バックエンドを自動検出します。MSMQ イグジットポイントは、メッセージをキューにパブリッシュまたはプッシュするメソッドです。MSMQ トランスポート経由で NServiceBus を使用している場合は、「 .NETのNServiceBusバックエンド」を参照してください。

MSMQ エントリポイントは、キュー内の新しいメッセージをリッスンまたはポーリングするメソッドです。エージェントが MSMQ のエントリポイントを検出したり、ダウンストリーム相関を実行する前に、相関フィールドを定義し、マルチスレッド アーキテクチャの場合はスレディングアーキテクチャを指定する必要があります。

イグジットポイントとバックエンドの命名

システムから返されたキュー名が、エージェントによりキューに命名されます。

Entry Points

To enable downstream correlation for MSMQ, you must configure the agent.

Define the MSMQ Correlation Field

Register the msmq-correlation-field app agent node property on both the publishing tier and on the receiving tier. Specify the field where the agent will write and read correlation information.

The agent supports the following fields:

  • Extension, the default field
  • Label

By default, the .NET Agent writes to the Extension field. However, some frameworks built on MSMQ write data to the Extension field. In this case, the Extension field does not work because it is already in use, so you must configure the .NET Agent to write correlation data to the Label field.

注: Choose a field not in use by your queue implementation. If your implementation uses both the "Label" and "Extension" fields, downstream correlation is not currently possible.

See "msmq-correlation-field" on App Agent Node Properties Reference. For instructions to register a node property, see App Agent Node Properties.

Specify the threading architecture

If your queue implementation uses a multithreaded architecture, you must register the msmq-single-threaded app agent node property to specify the threading architecture. Set msmq-single-threaded to "False" for multithreaded implementations of MSMQ. See "msmq-single-threaded" on App Agent Node Properties Reference. For instructions to register a node property, see App Agent Node Properties.

The threading architecture dictates how the agent calculates the call timing for the message queue:

  • For single-threaded queues, the agent calculates the call time between receive requests. The call time begins at the end of the first receive method and ends when the next receive method starts.In the following example, the length of the ProcessMessage()

    MessageQueue messageQueue;
    for(;;)
    {
    var message = messageQueue.Receive();
    ProcessMessage(message);
    }
  • For multithreaded queues, the agent does not capture timing.