DefaultPropertiesToSend Klasa

Definicja

Określa domyślne wartości właściwości, które będą używane podczas wysyłania obiektów innych niż Message wystąpienia do kolejki komunikatów.

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
Dziedziczenie
DefaultPropertiesToSend
Atrybuty

Przykłady

Poniższy przykład kodu używa priorytetu komunikatu w celu określenia domyślnych właściwości do wysłania komunikatu.

#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

Uwagi

Możesz ustawić wartości domyślne dla wybranych właściwości dla komunikatów wysyłanych do obiektu MessageQueue. DefaultPropertiesToSend Służy do określania domyślnych wartości właściwości komunikatu wysyłanego, gdy obiekty inne niż Message wystąpienia są wysyłane do kolejki, na przykład argument ciągu przekazany do Send metody w fragmencie myMessageQueue.Send("hello")kodu. Klasa Message ma odpowiednie, identyczne nazwane właściwości do tych w DefaultPropertiesToSend , które zapewniają wartości podczas wysyłania Message wystąpienia specjalnie. Nawet jeśli określono MessageQueue.DefaultPropertiesToSend dla kolejki, wysłanie Message obiektu do tej kolejki spowoduje, że wartości identycznych nazwanych Message właściwości zastąpią wartości kolejki DefaultPropertiesToSend .

Właściwości, które nie są ustawione jawnie domyślne dla wartości określonych przez konstruktor, DefaultPropertiesToSend.

Aby uzyskać listę początkowych wartości właściwości dla wystąpienia programu DefaultPropertiesToSend, zobacz DefaultPropertiesToSend konstruktor.

Konstruktory

DefaultPropertiesToSend()

Inicjuje nowe wystąpienie klasy DefaultPropertiesToSend.

Właściwości

AcknowledgeType

Pobiera lub ustawia typ komunikatu potwierdzenia, który ma zostać zwrócony do aplikacji wysyłającej.

AdministrationQueue

Pobiera lub ustawia kolejkę, która odbiera komunikaty potwierdzenia wygenerowane przez kolejkowanie komunikatów.

AppSpecific

Pobiera lub ustawia dodatkowe informacje specyficzne dla aplikacji.

AttachSenderId

Pobiera lub ustawia wartość wskazującą, czy identyfikator nadawcy powinien być dołączony do wiadomości.

EncryptionAlgorithm

Pobiera lub ustawia algorytm szyfrowania używany do szyfrowania treści wiadomości prywatnej.

Extension

Pobiera lub ustawia dodatkowe informacje skojarzone z komunikatem.

HashAlgorithm

Pobiera lub ustawia algorytm wyznaczania wartości skrótu używany podczas uwierzytelniania komunikatów lub tworzenia podpisu cyfrowego dla wiadomości.

Label

Pobiera lub ustawia ciąg zdefiniowany przez aplikację, który opisuje komunikat.

Priority

Pobiera lub ustawia priorytet komunikatu, który służy do określania lokalizacji komunikatu w kolejce.

Recoverable

Pobiera lub ustawia wartość wskazującą, czy komunikat ma zostać dostarczony w przypadku awarii komputera lub problemu z siecią.

ResponseQueue

Pobiera lub ustawia kolejkę, która odbiera komunikaty odpowiedzi wygenerowane przez aplikację.

TimeToBeReceived

Pobiera lub ustawia limit czasu pobierania komunikatu z kolejki docelowej.

TimeToReachQueue

Pobiera lub ustawia limit czasu dla komunikatu, aby dotarł do kolejki.

TransactionStatusQueue

Pobiera kolejkę stanu transakcji na komputerze źródłowym.

UseAuthentication

Pobiera lub ustawia wartość wskazującą, czy wiadomość musi zostać uwierzytelniona przed wysłaniem.

UseDeadLetterQueue

Pobiera lub ustawia wartość wskazującą, czy kopia komunikatu, którego nie można dostarczyć, powinna zostać wysłana do kolejki utraconych wiadomości.

UseEncryption

Pobiera lub ustawia wartość wskazującą, czy wiadomość ma być prywatna.

UseJournalQueue

Pobiera lub ustawia wartość wskazującą, czy kopia komunikatu powinna być przechowywana w dzienniku maszynowym na komputerze źródłowym.

UseTracing

Pobiera lub ustawia wartość wskazującą, czy prześledzić komunikat w kolejce docelowej.

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też