MessageQueue.DefaultPropertiesToSend Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft die Nachrichteneigenschaftswerte ab, die standardmäßig verwendet werden sollen, wenn die Anwendung Nachrichten an die Warteschlange sendet, oder legt diese fest.
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
Eigenschaftswert
A DefaultPropertiesToSend that contains the default Message Queuing message property values used when the application sends objects other than Message instances to the queue.
- Attribute
Ausnahmen
Die Standardeigenschaften konnten für die Warteschlange nicht festgelegt werden, möglicherweise weil eine der Eigenschaften ungültig ist.
Beispiele
Im folgenden Codebeispiel wird die Priorität einer Nachricht verwendet, um die Standardeigenschaften zu ermitteln, die für die Nachricht gesendet werden sollen.
#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
Hinweise
Wenn Sie ein Objekt senden, das nicht vom Typ Message an die Warteschlange ist, wird das MessageQueue Objekt in eine Message Queuing-Nachricht eingefügt. Zu diesem Zeitpunkt gilt dies für die MessageQueue Nachricht, die Die Eigenschaftswerte, die Sie in der DefaultPropertiesToSend Eigenschaft angeben. Wenn Sie hingegen eine Message an die Warteschlange senden, werden diese Eigenschaften bereits für die Instanz selbst angegeben, daher DefaultPropertiesToSend wird sie für die Message.
Obwohl Sie die Eigenschaften über das MessageQueue Objekt festlegen, bezieht sich dies DefaultPropertiesToSend auf die Eigenschaften der Nachrichten, die an die Warteschlange gesendet werden, nicht auf die Warteschlange selbst.
Die Standardwerte für die Eigenschaften werden in der folgenden Tabelle angezeigt.
| Eigentum | Standardwert |
|---|---|
| AcknowledgeType | AcknowledgeType.None |
| AdministrationQueue | null |
| AppSpecific | Null (0) |
| AttachSenderId | true |
| EncryptionAlgorithm | EncryptionAlgorithm.RC2 |
| Extension | Ein Array der Länge Null von Bytes |
| HashAlgorithm | HashAlgorithm.MD5 |
| Label | Leere Zeichenfolge ("") |
| 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 |
In der folgenden Tabelle wird gezeigt, ob diese Eigenschaft in verschiedenen Arbeitsgruppenmodi verfügbar ist.
| Arbeitsgruppenmodus | Verfügbar |
|---|---|
| Lokaler Computer | Ja |
| Name des lokalen Computers und des direkten Formats | Ja |
| Remotecomputer | Ja |
| Name des Remotecomputers und des direkten Formats | Ja |