MessageQueue.DefaultPropertiesToSend プロパティ

定義

アプリケーションがメッセージをキューに送信するときに既定で使用されるメッセージ プロパティ値を取得または設定します。

public:
 property System::Messaging::DefaultPropertiesToSend ^ DefaultPropertiesToSend { System::Messaging::DefaultPropertiesToSend ^ get(); void set(System::Messaging::DefaultPropertiesToSend ^ value); };
[System.ComponentModel.Browsable(false)]
[System.Messaging.MessagingDescription("MQ_DefaultPropertiesToSend")]
public System.Messaging.DefaultPropertiesToSend DefaultPropertiesToSend { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Messaging.MessagingDescription("MQ_DefaultPropertiesToSend")>]
member this.DefaultPropertiesToSend : System.Messaging.DefaultPropertiesToSend with get, set
Public Property DefaultPropertiesToSend As DefaultPropertiesToSend

プロパティ値

アプリケーションが DefaultPropertiesToSend インスタンス以外のオブジェクトをキューに送信するときに使用する既定のメッセージ キューのメッセージ プロパティ値を含む Message

属性

例外

既定のプロパティをキューに設定できませんでした。いずれかのプロパティが無効であることが原因である可能性があります。

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

#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

注釈

Message 以外のオブジェクトをキューに送信すると、 MessageQueue は オブジェクトをメッセージ キュー メッセージに挿入します。 その時点で、 は MessageQueue 、プロパティで指定したプロパティ値をメッセージに DefaultPropertiesToSend 適用します。 逆に、 をキューに送信 Message する場合、これらのプロパティはインスタンス自体に対して既に指定されているため DefaultPropertiesToSendMessageでは無視されます。

オブジェクトを使用してプロパティを MessageQueue 設定しますが、 DefaultPropertiesToSend はキュー自体ではなく、キューに送信されるメッセージのプロパティを参照します。

プロパティの既定値を次の表に示します。

プロパティ 既定値
AcknowledgeType AcknowledgeType.None
AdministrationQueue null
AppSpecific ゼロ (0)
AttachSenderId true
EncryptionAlgorithm EncryptionAlgorithm.RC2
Extension バイトの長さ 0 の配列
HashAlgorithm HashAlgorithm.MD5
Label 空の文字列 ("")
Priority MessagePriority.Normal
Recoverable false
ResponseQueue null
TimeToBeReceived Message.InfiniteTimeout
TimeToReachQueue Message.InfiniteTimeout
TransactionStatusQueue null
UseAuthentication false
UseDeadLetterQueue false
UseEncryption false
UseJournalQueue false
UseTracing false

次の表は、このプロパティがさまざまなワークグループ モードで使用できるかどうかを示しています。

ワークグループ モード 利用可能
ローカル コンピューター はい
ローカル コンピューターと直接形式の名前 はい
リモート コンピューター はい
リモート コンピューターと直接形式の名前 はい

適用対象

こちらもご覧ください