DefaultPropertiesToSendとは? わかりやすく解説

DefaultPropertiesToSend クラス

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

名前空間: System.Messaging
アセンブリ: System.Messaging (system.messaging.dll 内)
構文構文

Public Class DefaultPropertiesToSend
Dim instance As DefaultPropertiesToSend
public class DefaultPropertiesToSend
public ref class DefaultPropertiesToSend
public class DefaultPropertiesToSend
public class DefaultPropertiesToSend
解説解説
使用例使用例

メッセージ優先順位使用してメッセージ送信するときの既定プロパティ決定するコード例次に示します

Imports System
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 'Main



        ' 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 'SendHighPriorityMessages



        ' 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 'SendNormalPriorityMessages

End Class 'MyNewQueue

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;
        }
    }
}
#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;
}

package MyProject;

import System.*;
import System.Messaging.*;

/// <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(String[]
 args)
    {
        // Create a new instance of the class.
        MyNewQueue myNewQueue = new MyNewQueue();
        // Send normal and high priority messages.
        myNewQueue.SendNormalPriorityMessages();
        myNewQueue.SendHighPriorityMessages();
        return;
    } //main

    //**************************************************
    // 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.get_DefaultPropertiesToSend().
            set_Priority(MessagePriority.High);
        myQueue.get_DefaultPropertiesToSend().
            set_Label("High Priority Message");
        myQueue.get_DefaultPropertiesToSend().
            set_Recoverable(true);
        myQueue.get_DefaultPropertiesToSend().
            set_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;
    } //SendHighPriorityMessages

    //**************************************************
    // 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.get_DefaultPropertiesToSend().
            set_Priority(MessagePriority.Normal);
        myQueue.get_DefaultPropertiesToSend().
            set_Label("Normal Priority Message");
        myQueue.get_DefaultPropertiesToSend().
            set_Recoverable(false);
        myQueue.get_DefaultPropertiesToSend().
            set_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;
    } //SendNormalPriorityMessages
} //MyNewQueue
継承階層継承階層
System.Object
  System.Messaging.DefaultPropertiesToSend
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DefaultPropertiesToSend メンバ
System.Messaging 名前空間
Message
MessageQueue.DefaultPropertiesToSend

DefaultPropertiesToSend コンストラクタ

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

名前空間: System.Messaging
アセンブリ: System.Messaging (system.messaging.dll 内)
構文構文

Dim instance As New DefaultPropertiesToSend
public DefaultPropertiesToSend ()
public:
DefaultPropertiesToSend ()
public DefaultPropertiesToSend ()
public function DefaultPropertiesToSend ()
解説解説

DefaultPropertiesToSend新しインスタンス作成することで、キュー送信される Message以外のオブジェクト関連付けるプロパティ既定値を定義できますMessageQueue オブジェクトを使うときにはDefaultPropertiesToSend インスタンス作成されMessageQueue の MessageQueue.DefaultPropertiesToSend メンバ関連付けられます。

オブジェクト送信するキュープロパティ既定値定義する方法は、次の C#コードに示ように 2 とおりあります1 つ目の方法として、DefaultPropertiesToSendインスタンスの値を設定し、それをキューMessageQueue.DefaultPropertiesToSend プロパティ関連付けることができます

DefaultPropertiesToSend myDefaultProperties = new DefaultPropertiesToSend();
  // Set default values for the properties.
  myDefaultProperties.Label = "myLabel";
  myDefaultProperties.Recoverable = false;
 ...
  myMessageQueue.DefaultPropertiesToSend = myDefaultProperties;
  myMessageQueue.Send("hello");

もう 1 つ方法として、MessageQueue インスタンスDefaultPropertiesToSend プロパティに値を個別直接割り当てることもできます

myMessageQueue.DefaultPropertiesToSend.Label = "myLabel";
  myMessageQueue.DefaultPropertiesToSend.Recoverable = false;
...
  myMessageQueue.Send("hello");

2 つ目の方法を使う場合は、DefaultPropertiesToSend コンストラクタ明示的に呼び出す必要はありません。DefaultPropertiesToSendインスタンス作成する必要がある場合あります。たとえば、送信するメッセージ条件に応じてプロパティ既定値変化する場合です。このような場合は、複数DefaultPropertiesToSend インスタンス作成してキューメッセージ送信する前にキューMessageQueue.DefaultPropertiesToSend プロパティインスタンス1 つ割り当てることができます

DefaultPropertiesToSendインスタンス初期プロパティ値を次の表に示します

プロパティ

初期値

AcknowledgeType

AcknowledgeTypes.None

AdministrationQueue

null 参照 (Visual Basic では Nothing)

AppSpecific

0

AttachSenderId

true

EncryptionAlgorithm

EncryptionAlgorithm.RC2

Extension

長さ 0 のバイト配列

HashAlgorithm

HashAlgorithm.MD5

Label

空の文字列 ("")。

Priority

MessagePriority.Normal

Recoverable

false

ResponseQueue

null 参照 (Visual Basic では Nothing)

TimeToBeReceived

Message.InfiniteTimeout

TimeToReachQueue

Message.InfiniteTimeout

TransactionStatusQueue

null 参照 (Visual Basic では Nothing)

UseAuthentication

false

UseDeadLetterQueue

false

UseEncryption

false

UseJournalQueue

false

UseTracing

false

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DefaultPropertiesToSend クラス
DefaultPropertiesToSend メンバ
System.Messaging 名前空間
AcknowledgeTypes 列挙
EncryptionAlgorithm
HashAlgorithm
MessagePriority
InfiniteTimeout
DefaultPropertiesToSend
Message

DefaultPropertiesToSend プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

DefaultPropertiesToSend クラス
System.Messaging 名前空間
Message
MessageQueue.DefaultPropertiesToSend

DefaultPropertiesToSend メソッド


DefaultPropertiesToSend メンバ

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

DefaultPropertiesToSend データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DefaultPropertiesToSend DefaultPropertiesToSend クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DefaultPropertiesToSend クラス
System.Messaging 名前空間
Message
MessageQueue.DefaultPropertiesToSend



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DefaultPropertiesToSend」の関連用語

DefaultPropertiesToSendのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DefaultPropertiesToSendのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS