Share via


MessageQueue.DefaultPropertiesToSend-Eigenschaft

Ruft die Eigenschaftenwerte für Meldungen ab, die beim Senden einer Meldung an die Warteschlange standardmäßig verwendet werden.

Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)

Syntax

'Declaration
Public Property DefaultPropertiesToSend As DefaultPropertiesToSend
'Usage
Dim instance As MessageQueue
Dim value As DefaultPropertiesToSend

value = instance.DefaultPropertiesToSend

instance.DefaultPropertiesToSend = value
public DefaultPropertiesToSend DefaultPropertiesToSend { get; set; }
public:
property DefaultPropertiesToSend^ DefaultPropertiesToSend {
    DefaultPropertiesToSend^ get ();
    void set (DefaultPropertiesToSend^ value);
}
/** @property */
public DefaultPropertiesToSend get_DefaultPropertiesToSend ()

/** @property */
public void set_DefaultPropertiesToSend (DefaultPropertiesToSend value)
public function get DefaultPropertiesToSend () : DefaultPropertiesToSend

public function set DefaultPropertiesToSend (value : DefaultPropertiesToSend)

Eigenschaftenwert

Ein DefaultPropertiesToSend mit den Standardeigenschaftenwerten für Meldungen in Message Queuing, die verwendet werden, wenn die Anwendung andere Objekte als Message-Instanzen an die Warteschlange sendet.

Ausnahmen

Ausnahmetyp Bedingung

ArgumentException

Die Standardeigenschaften konnten für diese Warteschlange nicht festgelegt werden. Möglicherweise ist eine der Eigenschaften ungültig.

Hinweise

Wenn Sie ein Objekt an eine Warteschlange senden, das nicht vom Typ Message ist, wird das Objekt von MessageQueue in eine Message Queuing-Meldung eingebunden. Zu diesem Zeitpunkt übernimmt die MessageQueue die in der DefaultPropertiesToSend-Eigenschaft festgelegten Eigenschaftenwerte für die Meldung. Wenn Sie im Gegensatz hierzu eine Message an die Warteschlange senden, sind diese Eigenschaften bereits für die Instanz selbst festgelegt. Daher wird DefaultPropertiesToSend für die Message ignoriert.

Obwohl die Eigenschaften über das MessageQueue-Objekt festgelegt werden, bezieht sich DefaultPropertiesToSend auf die Eigenschaften der an die Warteschlange gesendeten Meldungen und nicht auf die Warteschlange selbst.

Die Standardwerte für die Eigenschaften werden in der folgenden Tabelle aufgeführt.

Eigenschaft

Standardwert

AcknowledgeType

AcknowledgeType.None

AdministrationQueue

NULL (Nothing in Visual Basic)

AppSpecific

Null (0).

AttachSenderId

true

EncryptionAlgorithm

EncryptionAlgorithm.RC2

Extension

Ein Bytearray mit der Länge 0

HashAlgorithm

HashAlgorithm.MD5

Label

Leere Zeichenfolge ("")

Priority

MessagePriority.Normal

Recoverable

false

ResponseQueue

NULL (Nothing in Visual Basic)

TimeToBeReceived

Message.InfiniteTimeout

TimeToReachQueue

Message.InfiniteTimeout

TransactionStatusQueue

NULL (Nothing in Visual Basic)

UseAuthentication

false

UseDeadLetterQueue

false

UseEncryption

false

UseJournalQueue

false

UseTracing

false

Der folgenden Tabelle können Sie entnehmen, ob diese Eigenschaft in verschiedenen Arbeitsgruppenmodi verfügbar ist.

Arbeitsgruppenmodus

Verfügbar

Lokaler Computer

Ja

Lokaler Computer + direkter Formatname

Ja

Remotecomputer

Ja

Lokaler Computer + direkter Formatname

Ja

Beispiel

Im folgenden Codebeispiel werden die Standardeigenschaften zum Senden der Meldung anhand der Priorität einer Meldung bestimmt.

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

.NET Framework-Sicherheit

  • Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter .

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

MessageQueue-Klasse
MessageQueue-Member
System.Messaging-Namespace
Message-Klasse
AcknowledgeTypes-Enumeration
EncryptionAlgorithm-Enumeration
HashAlgorithm-Enumeration
InfiniteTimeout