DefaultPropertiesToSend クラス

定義

Message インスタンス以外のオブジェクトをメッセージ キューに送信するときに使用する既定のプロパティ値を指定します。

public ref class DefaultPropertiesToSend
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
public class DefaultPropertiesToSend
[<System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))>]
type DefaultPropertiesToSend = class
Public Class DefaultPropertiesToSend
継承
DefaultPropertiesToSend
属性

次のコード例では、メッセージの優先度を使用して、メッセージに送信する既定のプロパティを決定します。

#using <system.dll>
#using <system.messaging.dll>

using namespace System;
using namespace System::Messaging;
ref class MyNewQueue
{
public:

   // Associates selected message property values
   // with high priority messages.
   void SendHighPriorityMessages()
   {
      
      // Connect to a message queue.
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );
      
      // Associate selected default property values with high
      // priority messages.
      myQueue->DefaultPropertiesToSend->Priority = MessagePriority::High;
      myQueue->DefaultPropertiesToSend->Label = "High Priority Message";
      myQueue->DefaultPropertiesToSend->Recoverable = true;
      myQueue->DefaultPropertiesToSend->TimeToReachQueue = TimeSpan(0,0,30);
      
      // Send messages using these defaults.
      myQueue->Send( "High priority message data 1." );
      myQueue->Send( "High priority message data 2." );
      myQueue->Send( "High priority message data 3." );
      return;
   }


   // Associates selected message property values
   // with normal priority messages.
   void SendNormalPriorityMessages()
   {
      
      // Connect to a message queue.
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );
      
      // Associate selected default property values with normal
      // priority messages.
      myQueue->DefaultPropertiesToSend->Priority = MessagePriority::Normal;
      myQueue->DefaultPropertiesToSend->Label = "Normal Priority Message";
      myQueue->DefaultPropertiesToSend->Recoverable = false;
      myQueue->DefaultPropertiesToSend->TimeToReachQueue = TimeSpan(0,2,0);
      
      // Send messages using these defaults.
      myQueue->Send( "Normal priority message data 1." );
      myQueue->Send( "Normal priority message data 2." );
      myQueue->Send( "Normal priority message data 3." );
      return;
   }

};


// Provides an entry point into the application.
// This example specifies different types of default
// properties for messages.
int main()
{
   
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;
   
   // Send normal and high priority messages.
   myNewQueue->SendNormalPriorityMessages();
   myNewQueue->SendHighPriorityMessages();
   return 0;
}
using System;
using System.Messaging;

namespace MyProject
{
    /// <summary>
    /// Provides a container class for the example.
    /// </summary>
    public class MyNewQueue
    {

        //**************************************************
        // Provides an entry point into the application.
        //		
        // This example specifies different types of default
        // properties for messages.
        //**************************************************

        public static void Main()
        {
            // Create a new instance of the class.
            MyNewQueue myNewQueue = new MyNewQueue();

            // Send normal and high priority messages.
            myNewQueue.SendNormalPriorityMessages();
            myNewQueue.SendHighPriorityMessages();
                        
            return;
        }

        //**************************************************
        // Associates selected message property values
        // with high priority messages.
        //**************************************************
        
        public void SendHighPriorityMessages()
        {

            // Connect to a message queue.
            MessageQueue myQueue = new
                MessageQueue(".\\myQueue");

            // Associate selected default property values with high
            // priority messages.
            myQueue.DefaultPropertiesToSend.Priority =
                MessagePriority.High;
            myQueue.DefaultPropertiesToSend.Label =
                "High Priority Message";
            myQueue.DefaultPropertiesToSend.Recoverable = true;
            myQueue.DefaultPropertiesToSend.TimeToReachQueue =
                new TimeSpan(0,0,30);
            
            // Send messages using these defaults.
            myQueue.Send("High priority message data 1.");
            myQueue.Send("High priority message data 2.");
            myQueue.Send("High priority message data 3.");
            
            return;
        }

        //**************************************************
        // Associates selected message property values
        // with normal priority messages.
        //**************************************************
        
        public void SendNormalPriorityMessages()
        {

            // Connect to a message queue.
            MessageQueue myQueue = new MessageQueue(".\\myQueue");

            // Associate selected default property values with normal
            // priority messages.
            myQueue.DefaultPropertiesToSend.Priority =
                MessagePriority.Normal;
            myQueue.DefaultPropertiesToSend.Label =
                "Normal Priority Message";
            myQueue.DefaultPropertiesToSend.Recoverable = false;
            myQueue.DefaultPropertiesToSend.TimeToReachQueue =
                new TimeSpan(0,2,0);
            
            // Send messages using these defaults.
            myQueue.Send("Normal priority message data 1.");
            myQueue.Send("Normal priority message data 2.");
            myQueue.Send("Normal priority message data 3.");
            
            return;
        }
    }
}
Imports System.Messaging

Public Class MyNewQueue



        ' Provides an entry point into the application.
        '		 
        ' This example specifies different types of default
        ' properties for messages.


        Public Shared Sub Main()

            ' Create a new instance of the class.
            Dim myNewQueue As New MyNewQueue()

            ' Send normal and high priority messages.
            myNewQueue.SendNormalPriorityMessages()
            myNewQueue.SendHighPriorityMessages()

            Return

        End Sub



        ' Associates selected message property values
        ' with high priority messages.
 

        Public Sub SendHighPriorityMessages()

            ' Connect to a message queue.
            Dim myQueue As New MessageQueue(".\myQueue")

            ' Associate selected default property values with high
            ' priority messages.
            myQueue.DefaultPropertiesToSend.Priority = _
                MessagePriority.High
            myQueue.DefaultPropertiesToSend.Label = _
                "High Priority Message"
            myQueue.DefaultPropertiesToSend.Recoverable = True
            myQueue.DefaultPropertiesToSend.TimeToReachQueue = _
                New TimeSpan(0, 0, 30)

            ' Send messages using these defaults.
            myQueue.Send("High priority message data 1.")
            myQueue.Send("High priority message data 2.")
            myQueue.Send("High priority message data 3.")

            Return

        End Sub



        ' Associates selected message property values
        ' with normal priority messages.

        Public Sub SendNormalPriorityMessages()

            ' Connect to a message queue.
            Dim myQueue As New MessageQueue(".\myQueue")

            ' Associate selected default property values with normal
            ' priority messages.
            myQueue.DefaultPropertiesToSend.Priority = _
                MessagePriority.Normal
            myQueue.DefaultPropertiesToSend.Label = _
                "Normal Priority Message"
            myQueue.DefaultPropertiesToSend.Recoverable = False
            myQueue.DefaultPropertiesToSend.TimeToReachQueue = _
                New TimeSpan(0, 2, 0)

            ' Send messages using these defaults.
            myQueue.Send("Normal priority message data 1.")
            myQueue.Send("Normal priority message data 2.")
            myQueue.Send("Normal priority message data 3.")

            Return

        End Sub

End Class

注釈

MessageQueueに送信されるメッセージの選択したプロパティに既定値を設定できます。 DefaultPropertiesToSend は、 Message インスタンス以外のオブジェクトがキューに送信されるときに送信されるメッセージの既定のプロパティ値を指定するために使用されます。たとえば、コード フラグメント内の Send メソッドに渡される文字列引数 myMessageQueue.Send("hello")Message クラスには、Message インスタンスを具体的に送信するときに値を提供する、DefaultPropertiesToSend内のものと同じ名前の対応するプロパティがあります。 キューに MessageQueue.DefaultPropertiesToSend を指定した場合でも、そのキューに Message オブジェクトを送信すると、同じ名前の Message プロパティの値がキューの DefaultPropertiesToSend 値をオーバーライドします。

明示的に既定値を設定しないプロパティは、コンストラクターによって指定された値 DefaultPropertiesToSend

DefaultPropertiesToSendのインスタンスの初期プロパティ値の一覧については、DefaultPropertiesToSend コンストラクターを参照してください。

コンストラクター

名前 説明
DefaultPropertiesToSend()

DefaultPropertiesToSend クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
AcknowledgeType

送信側アプリケーションに返される受信確認メッセージの種類を取得または設定します。

AdministrationQueue

メッセージ キューによって生成された受信確認メッセージを受信するキューを取得または設定します。

AppSpecific

アプリケーション固有の追加情報を取得または設定します。

AttachSenderId

送信者 ID をメッセージに添付するかどうかを示す値を取得または設定します。

EncryptionAlgorithm

プライベート メッセージの本文の暗号化に使用する暗号化アルゴリズムを取得または設定します。

Extension

メッセージに関連付けられている追加情報を取得または設定します。

HashAlgorithm

メッセージを認証するとき、またはメッセージのデジタル署名を作成するときに使用するハッシュ アルゴリズムを取得または設定します。

Label

メッセージを記述するアプリケーション定義文字列を取得または設定します。

Priority

メッセージの優先順位を取得または設定します。これは、メッセージがキュー内のどこに配置されるかを決定するために使用されます。

Recoverable

コンピューターの障害またはネットワークの問題が発生した場合にメッセージの配信が保証されるかどうかを示す値を取得または設定します。

ResponseQueue

アプリケーションによって生成された応答メッセージを受信するキューを取得または設定します。

TimeToBeReceived

宛先キューから取得するメッセージの時間制限を取得または設定します。

TimeToReachQueue

メッセージがキューに到達する時間制限を取得または設定します。

TransactionStatusQueue

ソース コンピューターのトランザクション状態キューを取得します。

UseAuthentication

メッセージを送信する前に認証する必要があるかどうかを示す値を取得または設定します。

UseDeadLetterQueue

配信できなかったメッセージのコピーを配信不能キューに送信するかどうかを示す値を取得または設定します。

UseEncryption

メッセージをプライベートにするかどうかを示す値を取得または設定します。

UseJournalQueue

メッセージのコピーを元のコンピューターのコンピューター ジャーナルに保持するかどうかを示す値を取得または設定します。

UseTracing

メッセージを宛先キューに移動する際にトレースするかどうかを示す値を取得または設定します。

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください