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

適用対象

こちらもご覧ください